We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 530673b3 authored by Evan Prodromou's avatar Evan Prodromou

Merge branch '0.9.x' into testing

parents 2a1468ec 7ee875b1
......@@ -175,13 +175,43 @@ class Notice extends Memcached_DataObject
}
}
/**
* Save a new notice and push it out to subscribers' inboxes.
* Poster's permissions are checked before sending.
*
* @param int $profile_id Profile ID of the poster
* @param string $content source message text; links may be shortened
* per current user's preference
* @param string $source source key ('web', 'api', etc)
* @param array $options Associative array of optional properties:
* string 'created' timestamp of notice; defaults to now
* int 'is_local' source/gateway ID, one of:
* Notice::LOCAL_PUBLIC - Local, ok to appear in public timeline
* Notice::REMOTE_OMB - Sent from a remote OMB service;
* hide from public timeline but show in
* local "and friends" timelines
* Notice::LOCAL_NONPUBLIC - Local, but hide from public timeline
* Notice::GATEWAY - From another non-OMB service;
* will not appear in public views
* float 'lat' decimal latitude for geolocation
* float 'lon' decimal longitude for geolocation
* int 'location_id' geoname identifier
* int 'location_ns' geoname namespace to interpret location_id
* int 'reply_to'; notice ID this is a reply to
* int 'repeat_of'; notice ID this is a repeat of
* string 'uri' permalink to notice; defaults to local notice URL
*
* @return Notice
* @throws ClientException
*/
static function saveNew($profile_id, $content, $source, $options=null) {
$defaults = array('uri' => null,
'reply_to' => null,
'repeat_of' => null);
if (!empty($options)) {
$options = $options + $defaults;
extract($options);
if (!isset($reply_to)) {
$reply_to = NULL;
}
}
if (empty($is_local)) {
......@@ -966,6 +996,9 @@ class Notice extends Memcached_DataObject
return true;
}
/**
* @return array of integer profile IDs
*/
function saveReplies()
{
// Alternative reply format
......@@ -1044,8 +1077,8 @@ class Notice extends Memcached_DataObject
$recipientIds = array_keys($replied);
foreach ($recipientIds as $recipient) {
$user = User::staticGet('id', $recipient);
foreach ($recipientIds as $recipientId) {
$user = User::staticGet('id', $recipientId);
if ($user) {
mail_notify_attn($user, $this);
}
......
......@@ -180,6 +180,27 @@ class User extends Memcached_DataObject
return $result;
}
/**
* Register a new user account and profile and set up default subscriptions.
* If a new-user welcome message is configured, this will be sent.
*
* @param array $fields associative array of optional properties
* string 'bio'
* string 'email'
* bool 'email_confirmed' pass true to mark email as pre-confirmed
* string 'fullname'
* string 'homepage'
* string 'location' informal string description of geolocation
* float 'lat' decimal latitude for geolocation
* float 'lon' decimal longitude for geolocation
* int 'location_id' geoname identifier
* int 'location_ns' geoname namespace to interpret location_id
* string 'nickname' REQUIRED
* string 'password' (may be missing for eg OpenID registrations)
* string 'code' invite code
* ?string 'uri' permalink to notice; defaults to local notice URL
* @return mixed User object or false on failure
*/
static function register($fields) {
// MAGICALLY put fields into current scope
......@@ -329,7 +350,7 @@ class User extends Memcached_DataObject
$profile->query('COMMIT');
if ($email && !$user->email) {
if (!empty($email) && !$user->email) {
mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
}
......
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* PHP 5.3 implementation of function currying, using native closures.
* On 5.2 and lower we use the fallback implementation in util.php
*
* @param callback $fn
* @param ... any remaining arguments will be appended to call-time params
* @return callback
*/
function curry($fn) {
$extra_args = func_get_args();
array_shift($extra_args);
return function() use ($fn, $extra_args) {
$args = func_get_args();
return call_user_func_array($fn,
array_merge($args, $extra_args));
};
}
......@@ -523,19 +523,23 @@ function callback_helper($matches, $callback, $notice_id) {
return substr($matches[0],0,$left) . $result . substr($matches[0],$right);
}
function curry($fn) {
//TODO switch to a PHP 5.3 function closure based approach if PHP 5.3 is used
$args = func_get_args();
array_shift($args);
$id = uniqid('_partial');
$GLOBALS[$id] = array($fn, $args);
return create_function('',
'$args = func_get_args(); '.
'return call_user_func_array('.
'$GLOBALS["'.$id.'"][0],'.
'array_merge('.
'$args,'.
'$GLOBALS["'.$id.'"][1]));');
if (version_compare(PHP_VERSION, '5.3.0', 'ge')) {
// lambda implementation in a separate file; PHP 5.2 won't parse it.
require_once INSTALLDIR . "/lib/curry.php";
} else {
function curry($fn) {
$args = func_get_args();
array_shift($args);
$id = uniqid('_partial');
$GLOBALS[$id] = array($fn, $args);
return create_function('',
'$args = func_get_args(); '.
'return call_user_func_array('.
'$GLOBALS["'.$id.'"][0],'.
'array_merge('.
'$args,'.
'$GLOBALS["'.$id.'"][1]));');
}
}
function common_linkify($url) {
......@@ -1240,8 +1244,12 @@ function common_copy_args($from)
return $to;
}
// Neutralise the evil effects of magic_quotes_gpc in the current request.
// This is used before handing a request off to OAuthRequest::from_request.
/**
* Neutralise the evil effects of magic_quotes_gpc in the current request.
* This is used before handing a request off to OAuthRequest::from_request.
* @fixme Doesn't consider vars other than _POST and _GET?
* @fixme Can't be undone and could corrupt data if run twice.
*/
function common_remove_magic_from_request()
{
if(get_magic_quotes_gpc()) {
......@@ -1443,6 +1451,17 @@ function common_database_tablename($tablename)
return $tablename;
}
/**
* Shorten a URL with the current user's configured shortening service,
* or ur1.ca if configured, or not at all if no shortening is set up.
* Length is not considered.
*
* @param string $long_url
* @return string may return the original URL if shortening failed
*
* @fixme provide a way to specify a particular shortener
* @fixme provide a way to specify to use a given user's shortening preferences
*/
function common_shorten_url($long_url)
{
$user = common_current_user();
......@@ -1463,6 +1482,16 @@ function common_shorten_url($long_url)
}
}
/**
* @return mixed array($proxy, $ip) for web requests; proxy may be null
* null if not a web request
*
* @fixme X-Forwarded-For can be chained by multiple proxies;
we should parse the list and provide a cleaner array
* @fixme X-Forwarded-For can be forged by clients; only use them if trusted
* @fixme X_Forwarded_For headers will override X-Forwarded-For read through $_SERVER;
* use function to get exact request headers from Apache if possible.
*/
function common_client_ip()
{
if (!isset($_SERVER) || !array_key_exists('REQUEST_METHOD', $_SERVER)) {
......
......@@ -8,12 +8,12 @@ msgid ""
msgstr ""
"Project-Id-Version: StatusNet\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-14 20:34+0000\n"
"PO-Revision-Date: 2009-12-14 20:34:16+0000\n"
"POT-Creation-Date: 2009-12-16 22:51+0000\n"
"PO-Revision-Date: 2009-12-16 22:51:43+0000\n"
"Language-Team: Arabic\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: MediaWiki 1.16alpha (r60044); Translate extension (2009-12-06)\n"
"X-Generator: MediaWiki 1.16alpha (r60142); Translate extension (2009-12-06)\n"
"X-Translation-Project: translatewiki.net at http://translatewiki.net\n"
"X-Language-Code: ar\n"
"X-Message-Group: out-statusnet\n"
......@@ -36,17 +36,18 @@ msgstr "لا صفحة كهذه"
#: actions/apigroupleave.php:99 actions/apigrouplist.php:90
#: actions/apistatusesupdate.php:144 actions/apisubscriptions.php:87
#: actions/apitimelinefavorites.php:70 actions/apitimelinefriends.php:79
#: actions/apitimelinementions.php:79 actions/apitimelineuser.php:81
#: actions/avatarbynickname.php:75 actions/favoritesrss.php:74
#: actions/foaf.php:40 actions/foaf.php:58 actions/microsummary.php:62
#: actions/newmessage.php:116 actions/remotesubscribe.php:145
#: actions/remotesubscribe.php:154 actions/replies.php:73
#: actions/repliesrss.php:38 actions/showfavorites.php:105
#: actions/userbyid.php:74 actions/usergroups.php:91 actions/userrss.php:38
#: actions/xrds.php:71 lib/command.php:163 lib/command.php:311
#: lib/command.php:364 lib/command.php:409 lib/command.php:470
#: lib/command.php:526 lib/galleryaction.php:59 lib/mailbox.php:82
#: lib/profileaction.php:77 lib/subs.php:34 lib/subs.php:116
#: actions/apitimelinehome.php:79 actions/apitimelinementions.php:79
#: actions/apitimelineuser.php:81 actions/avatarbynickname.php:75
#: actions/favoritesrss.php:74 actions/foaf.php:40 actions/foaf.php:58
#: actions/microsummary.php:62 actions/newmessage.php:116
#: actions/remotesubscribe.php:145 actions/remotesubscribe.php:154
#: actions/replies.php:73 actions/repliesrss.php:38
#: actions/showfavorites.php:105 actions/userbyid.php:74
#: actions/usergroups.php:91 actions/userrss.php:38 actions/xrds.php:71
#: lib/command.php:163 lib/command.php:311 lib/command.php:364
#: lib/command.php:410 lib/command.php:471 lib/command.php:527
#: lib/galleryaction.php:59 lib/mailbox.php:82 lib/profileaction.php:77
#: lib/subs.php:34 lib/subs.php:116
msgid "No such user."
msgstr "لا مستخدم كهذا."
......@@ -56,7 +57,8 @@ msgid "%s and friends, page %d"
msgstr ""
#: actions/all.php:86 actions/all.php:167 actions/allrss.php:115
#: actions/apitimelinefriends.php:115 lib/personalgroupnav.php:100
#: actions/apitimelinefriends.php:115 actions/apitimelinehome.php:115
#: lib/personalgroupnav.php:100
#, php-format
msgid "%s and friends"
msgstr "%s والأصدقاء"
......@@ -108,6 +110,7 @@ msgid "You and friends"
msgstr "أنت والأصدقاء"
#: actions/allrss.php:119 actions/apitimelinefriends.php:122
#: actions/apitimelinehome.php:122
#, php-format
msgid "Updates from %1$s and friends on %2$s!"
msgstr ""
......@@ -226,8 +229,8 @@ msgstr ""
#: actions/apistatusnetconfig.php:133 actions/apistatusnetversion.php:93
#: actions/apisubscriptions.php:111 actions/apitimelinefavorites.php:146
#: actions/apitimelinefriends.php:156 actions/apitimelinegroup.php:150
#: actions/apitimelinementions.php:151 actions/apitimelinepublic.php:131
#: actions/apitimelineretweetedbyme.php:122
#: actions/apitimelinehome.php:156 actions/apitimelinementions.php:151
#: actions/apitimelinepublic.php:131 actions/apitimelineretweetedbyme.php:122
#: actions/apitimelineretweetedtome.php:121
#: actions/apitimelineretweetsofme.php:122 actions/apitimelinetag.php:141
#: actions/apitimelineuser.php:165 actions/apiusershow.php:101
......@@ -583,7 +586,7 @@ msgid "Preview"
msgstr "عاين"
#: actions/avatarsettings.php:149 lib/deleteuserform.php:66
#: lib/noticelist.php:611
#: lib/noticelist.php:603
msgid "Delete"
msgstr "احذف"
......@@ -803,7 +806,7 @@ msgstr "أمتأكد من أنك تريد حذف هذا الإشعار؟"
msgid "Do not delete this notice"
msgstr "لا تحذف هذا الإشعار"
#: actions/deletenotice.php:146 lib/noticelist.php:611
#: actions/deletenotice.php:146 lib/noticelist.php:603
msgid "Delete this notice"
msgstr "احذف هذا الإشعار"
......@@ -1860,7 +1863,7 @@ msgid "You can't send a message to this user."
msgstr ""
#: actions/newmessage.php:144 actions/newnotice.php:136 lib/command.php:351
#: lib/command.php:483
#: lib/command.php:484
msgid "No content!"
msgstr "لا محتوى!"
......@@ -1877,7 +1880,7 @@ msgstr ""
msgid "Message sent"
msgstr "أُرسلت الرسالة"
#: actions/newmessage.php:185 lib/command.php:375
#: actions/newmessage.php:185 lib/command.php:376
#, php-format
msgid "Direct message to %s sent"
msgstr ""
......@@ -1964,8 +1967,8 @@ msgstr "نوع المحتوى "
msgid "Only "
msgstr ""
#: actions/oembed.php:181 actions/oembed.php:200 lib/api.php:1030
#: lib/api.php:1058 lib/api.php:1168
#: actions/oembed.php:181 actions/oembed.php:200 lib/api.php:1031
#: lib/api.php:1059 lib/api.php:1169
msgid "Not a supported data format."
msgstr "ليس نسق بيانات مدعوم."
......@@ -2735,12 +2738,12 @@ msgstr "لا يمكنك إسكات المستخدمين على هذا الموق
msgid "You already repeated that notice."
msgstr "لقد منعت مسبقا هذا المستخدم."
#: actions/repeat.php:112 lib/noticelist.php:627
#: actions/repeat.php:114 lib/noticelist.php:621
#, fuzzy
msgid "Repeated"
msgstr "أنشئ"
#: actions/repeat.php:115
#: actions/repeat.php:119
#, fuzzy
msgid "Repeated!"
msgstr "أنشئ"
......@@ -3832,44 +3835,44 @@ msgstr ""
msgid "DB error inserting hashtag: %s"
msgstr ""
#: classes/Notice.php:196
#: classes/Notice.php:226
msgid "Problem saving notice. Too long."
msgstr "مشكلة في حفظ الإشعار. طويل جدًا."
#: classes/Notice.php:200
#: classes/Notice.php:230
msgid "Problem saving notice. Unknown user."
msgstr "مشكلة في حفظ الإشعار. مستخدم غير معروف."
#: classes/Notice.php:205
#: classes/Notice.php:235
msgid ""
"Too many notices too fast; take a breather and post again in a few minutes."
msgstr ""
#: classes/Notice.php:211
#: classes/Notice.php:241
msgid ""
"Too many duplicate messages too quickly; take a breather and post again in a "
"few minutes."
msgstr ""
#: classes/Notice.php:217
#: classes/Notice.php:247
msgid "You are banned from posting notices on this site."
msgstr ""
#: classes/Notice.php:289 classes/Notice.php:314
#: classes/Notice.php:319 classes/Notice.php:344
msgid "Problem saving notice."
msgstr "مشكلة أثناء حفظ الإشعار."
#: classes/Notice.php:993
#: classes/Notice.php:1044
#, php-format
msgid "DB error inserting reply: %s"
msgstr ""
#: classes/Notice.php:1320
#: classes/Notice.php:1371
#, fuzzy, php-format
msgid "RT @%1$s %2$s"
msgstr "%1$s (%2$s)"
#: classes/User.php:347
#: classes/User.php:368
#, php-format
msgid "Welcome to %1$s, @%2$s!"
msgstr "أهلا بكم في %1$s يا @%2$s!"
......@@ -4182,12 +4185,12 @@ msgstr ""
"المشتركون: %2$s\n"
"الإشعارات: %3$s"
#: lib/command.php:152 lib/command.php:398 lib/command.php:459
#: lib/command.php:152 lib/command.php:399 lib/command.php:460
msgid "Notice with that id does not exist"
msgstr ""
#: lib/command.php:168 lib/command.php:414 lib/command.php:475
#: lib/command.php:531
#: lib/command.php:168 lib/command.php:415 lib/command.php:476
#: lib/command.php:532
msgid "User has no last notice"
msgstr "ليس للمستخدم إشعار أخير"
......@@ -4220,105 +4223,105 @@ msgstr "الصفحة الرئيسية: %s"
msgid "About: %s"
msgstr "عن: %s"
#: lib/command.php:358 scripts/xmppdaemon.php:321
#: lib/command.php:358 scripts/xmppdaemon.php:301
#, php-format
msgid "Message too long - maximum is %d characters, you sent %d"
msgstr ""
#: lib/command.php:377
#: lib/command.php:378
msgid "Error sending direct message."
msgstr ""
#: lib/command.php:421
#: lib/command.php:422
msgid "Cannot repeat your own notice"
msgstr ""
#: lib/command.php:426
#: lib/command.php:427
#, fuzzy
msgid "Already repeated that notice"
msgstr "احذف هذا الإشعار"
#: lib/command.php:434
#: lib/command.php:435
#, fuzzy, php-format
msgid "Notice from %s repeated"
msgstr "أُرسل الإشعار"
#: lib/command.php:436
#: lib/command.php:437
#, fuzzy
msgid "Error repeating notice."
msgstr "خطأ أثناء حفظ الإشعار."
#: lib/command.php:490
#: lib/command.php:491
#, php-format
msgid "Notice too long - maximum is %d characters, you sent %d"
msgstr ""
#: lib/command.php:499
#: lib/command.php:500
#, php-format
msgid "Reply to %s sent"
msgstr "رُد على رسالة %s"
#: lib/command.php:501
#: lib/command.php:502
msgid "Error saving notice."
msgstr "خطأ أثناء حفظ الإشعار."
#: lib/command.php:555
#: lib/command.php:556
msgid "Specify the name of the user to subscribe to"
msgstr ""
#: lib/command.php:562
#: lib/command.php:563
#, php-format
msgid "Subscribed to %s"
msgstr "مُشترك ب%s"
#: lib/command.php:583
#: lib/command.php:584
msgid "Specify the name of the user to unsubscribe from"
msgstr ""
#: lib/command.php:590
#: lib/command.php:591
#, php-format
msgid "Unsubscribed from %s"
msgstr ""
#: lib/command.php:608 lib/command.php:631
#: lib/command.php:609 lib/command.php:632
msgid "Command not yet implemented."
msgstr ""
#: lib/command.php:611
#: lib/command.php:612
msgid "Notification off."
msgstr ""
#: lib/command.php:613
#: lib/command.php:614
msgid "Can't turn off notification."
msgstr ""
#: lib/command.php:634
#: lib/command.php:635
msgid "Notification on."
msgstr ""
#: lib/command.php:636
#: lib/command.php:637
msgid "Can't turn on notification."
msgstr ""
#: lib/command.php:649
#: lib/command.php:650
msgid "Login command is disabled"
msgstr ""
#: lib/command.php:663
#: lib/command.php:664
#, fuzzy, php-format
msgid "Could not create login token for %s"
msgstr "تعذّر إنشاء الكنى."
#: lib/command.php:668
#: lib/command.php:669
#, php-format
msgid "This link is useable only once, and is good for only 2 minutes: %s"
msgstr ""
#: lib/command.php:684
#: lib/command.php:685
msgid "You are not subscribed to anyone."
msgstr "لست مُشتركًا بأي أحد."
#: lib/command.php:686
#: lib/command.php:687
msgid "You are subscribed to this person:"
msgid_plural "You are subscribed to these people:"
msgstr[0] "لست مشتركًا بأحد."
......@@ -4328,11 +4331,11 @@ msgstr[3] "أنت مشترك بهؤلاء الأشخاص:"
msgstr[4] ""
msgstr[5] ""
#: lib/command.php:706
#: lib/command.php:707
msgid "No one is subscribed to you."
msgstr "لا أحد مشترك بك."
#: lib/command.php:708
#: lib/command.php:709
msgid "This person is subscribed to you:"
msgid_plural "These people are subscribed to you:"
msgstr[0] "لا أحد مشترك بك."
......@@ -4342,11 +4345,11 @@ msgstr[3] "هؤلاء الأشخاص مشتركون بك:"
msgstr[4] ""
msgstr[5] ""
#: lib/command.php:728
#: lib/command.php:729
msgid "You are not a member of any groups."
msgstr "لست عضوًا في أي مجموعة."
#: lib/command.php:730
#: lib/command.php:731
msgid "You are a member of this group:"
msgid_plural "You are a member of these groups:"
msgstr[0] "لست عضوًا في أي مجموعة."
......@@ -4356,7 +4359,7 @@ msgstr[3] "أنت عضو في هذه المجموعات:"
msgstr[4] ""
msgstr[5] ""
#: lib/command.php:744
#: lib/command.php:745
msgid ""
"Commands:\n"
"on - turn on notifications\n"
......@@ -4818,7 +4821,7 @@ msgid ""
"users in conversation. People can send you messages for your eyes only."
msgstr ""
#: lib/mailbox.php:227 lib/noticelist.php:468
#: lib/mailbox.php:227 lib/noticelist.php:469
msgid "from"
msgstr "من"
......@@ -4903,48 +4906,53 @@ msgstr "أرفق"
msgid "Attach a file"
msgstr "أرفق ملفًا"
#: lib/noticelist.php:419
#: lib/noticelist.php:420
#, php-format
msgid "%1$u°%2$u'%3$u\"%4$s %5$u°%6$u'%7$u\"%8$s"
msgstr ""
#: lib/noticelist.php:420
#: lib/noticelist.php:421
msgid "N"
msgstr "ش"
#: lib/noticelist.php:420
#: lib/noticelist.php:421
msgid "S"
msgstr "ج"
#: lib/noticelist.php:421
#: lib/noticelist.php:422
msgid "E"
msgstr "ر"
#: lib/noticelist.php:421
#: lib/noticelist.php:422
msgid "W"
msgstr "غ"
#: lib/noticelist.php:427
#: lib/noticelist.php:428
msgid "at"
msgstr "في"
#: lib/noticelist.php:522
#: lib/noticelist.php:523
msgid "in context"
msgstr "في السياق"
#: lib/noticelist.php:549
#: lib/noticelist.php:548
#, fuzzy
msgid "Repeated by"
msgstr "أنشئ"
#: lib/noticelist.php:587
#: lib/noticelist.php:577
msgid "Reply to this notice"
msgstr "رُد على هذا الإشعار"
#: lib/noticelist.php:588
#: lib/noticelist.php:578
msgid "Reply"
msgstr "رُد"
#: lib/noticelist.php:620
#, fuzzy