1 hunk ./actions/accesstoken.php 25
2 - function handle($args) {
3 - parent::handle($args);
5 - common_debug('getting request from env variables', __FILE__);
6 - common_remove_magic_from_request();
7 - $req = OAuthRequest::from_request();
8 - common_debug('getting a server', __FILE__);
9 - $server = omb_oauth_server();
10 - common_debug('fetching the access token', __FILE__);
11 - $token = $server->fetch_access_token($req);
12 - common_debug('got this token: "'.print_r($token,TRUE).'"', __FILE__);
13 - common_debug('printing the access token', __FILE__);
15 - } catch (OAuthException $e) {
16 - common_server_error($e->getMessage());
19 + function handle($args) {
20 + parent::handle($args);
22 + common_debug('getting request from env variables', __FILE__);
23 + common_remove_magic_from_request();
24 + $req = OAuthRequest::from_request();
25 + common_debug('getting a server', __FILE__);
26 + $server = omb_oauth_server();
27 + common_debug('fetching the access token', __FILE__);
28 + $token = $server->fetch_access_token($req);
29 + common_debug('got this token: "'.print_r($token,TRUE).'"', __FILE__);
30 + common_debug('printing the access token', __FILE__);
32 + } catch (OAuthException $e) {
33 + common_server_error($e->getMessage());
36 hunk ./actions/all.php 26
37 - function handle($args) {
38 + function handle($args) {
39 hunk ./actions/all.php 28
40 - parent::handle($args);
41 + parent::handle($args);
42 hunk ./actions/all.php 30
43 - $nickname = common_canonical_nickname($this->arg('nickname'));
44 - $user = User::staticGet('nickname', $nickname);
45 + $nickname = common_canonical_nickname($this->arg('nickname'));
46 + $user = User::staticGet('nickname', $nickname);
47 hunk ./actions/all.php 33
49 - $this->client_error(_('No such user.'));
53 + $this->client_error(_('No such user.'));
56 hunk ./actions/all.php 38
57 - $profile = $user->getProfile();
58 + $profile = $user->getProfile();
59 hunk ./actions/all.php 40
61 - common_server_error(_('User has no profile.'));
65 + common_server_error(_('User has no profile.'));
68 hunk ./actions/all.php 45
69 - # Looks like we're good; show the header
70 + # Looks like we're good; show the header
71 hunk ./actions/all.php 47
72 - common_show_header(sprintf(_("%s and friends"), $profile->nickname),
73 - array($this, 'show_header'), $user,
74 - array($this, 'show_top'));
75 + common_show_header(sprintf(_("%s and friends"), $profile->nickname),
76 + array($this, 'show_header'), $user,
77 + array($this, 'show_top'));
78 hunk ./actions/all.php 51
79 - $this->show_notices($user);
80 + $this->show_notices($user);
81 hunk ./actions/all.php 53
82 - common_show_footer();
84 + common_show_footer();
86 hunk ./actions/all.php 56
87 - function show_header($user) {
88 - common_element('link', array('rel' => 'alternate',
89 - 'href' => common_local_url('allrss', array('nickname' =>
91 - 'type' => 'application/rss+xml',
92 - 'title' => sprintf(_('Feed for friends of %s'), $user->nickname)));
94 + function show_header($user) {
95 + common_element('link', array('rel' => 'alternate',
96 + 'href' => common_local_url('allrss', array('nickname' =>
98 + 'type' => 'application/rss+xml',
99 + 'title' => sprintf(_('Feed for friends of %s'), $user->nickname)));
101 hunk ./actions/all.php 64
102 - function show_top($user) {
103 - $cur = common_current_user();
104 + function show_top($user) {
105 + $cur = common_current_user();
106 hunk ./actions/all.php 67
107 - if ($cur && $cur->id == $user->id) {
108 - common_notice_form('all');
110 + if ($cur && $cur->id == $user->id) {
111 + common_notice_form('all');
113 hunk ./actions/all.php 71
114 - $this->views_menu();
115 + $this->views_menu();
116 hunk ./actions/all.php 73
117 - $this->show_feeds_list(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $user->nickname)),
119 - 'version' => 'RSS 1.0',
120 - 'item' => 'allrss')));
122 + $this->show_feeds_list(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $user->nickname)),
124 + 'version' => 'RSS 1.0',
125 + 'item' => 'allrss')));
127 hunk ./actions/all.php 79
128 - function show_notices($user) {
129 + function show_notices($user) {
130 hunk ./actions/all.php 81
131 - $page = $this->trimmed('page');
135 + $page = $this->trimmed('page');
139 hunk ./actions/all.php 86
140 - $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
141 + $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
142 hunk ./actions/all.php 90
143 - common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
144 - $page, 'all', array('nickname' => $user->nickname));
146 + common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
147 + $page, 'all', array('nickname' => $user->nickname));
149 hunk ./actions/allrss.php 28
152 hunk ./actions/allrss.php 30
154 - $nickname = $this->trimmed('nickname');
155 - $this->user = User::staticGet('nickname', $nickname);
157 + $nickname = $this->trimmed('nickname');
158 + $this->user = User::staticGet('nickname', $nickname);
159 hunk ./actions/allrss.php 34
160 - if (!$this->user) {
161 - common_user_error(_('No such user.'));
167 + if (!$this->user) {
168 + common_user_error(_('No such user.'));
174 hunk ./actions/allrss.php 42
175 - function get_notices($limit=0) {
176 + function get_notices($limit=0) {
177 hunk ./actions/allrss.php 44
178 - $user = $this->user;
180 - $notice = $user->noticesWithFriends(0, $limit);
182 - while ($notice->fetch()) {
183 - $notices[] = clone($notice);
185 + $user = $this->user;
187 + $notice = $user->noticesWithFriends(0, $limit);
189 + while ($notice->fetch()) {
190 + $notices[] = clone($notice);
192 hunk ./actions/allrss.php 52
197 hunk ./actions/allrss.php 55
198 - function get_channel() {
199 - $user = $this->user;
200 - $c = array('url' => common_local_url('allrss',
201 - array('nickname' =>
203 - 'title' => sprintf(_('%s and friends'), $user->nickname),
204 - 'link' => common_local_url('all',
205 - array('nickname' =>
207 - 'description' => sprintf(_('Feed for friends of %s'), $user->nickname));
210 + function get_channel() {
211 + $user = $this->user;
212 + $c = array('url' => common_local_url('allrss',
213 + array('nickname' =>
215 + 'title' => sprintf(_('%s and friends'), $user->nickname),
216 + 'link' => common_local_url('all',
217 + array('nickname' =>
219 + 'description' => sprintf(_('Feed for friends of %s'), $user->nickname));
222 hunk ./actions/allrss.php 68
223 - function get_image() {
224 - $user = $this->user;
225 - $profile = $user->getProfile();
229 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
230 - return ($avatar) ? $avatar->url : NULL;
232 + function get_image() {
233 + $user = $this->user;
234 + $profile = $user->getProfile();
238 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
239 + return ($avatar) ? $avatar->url : NULL;
241 hunk ./actions/api.php 13
242 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
243 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
244 hunk ./actions/api.php 17
245 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
246 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
247 hunk ./actions/api.php 24
258 hunk ./actions/api.php 30
259 - function handle($args) {
260 - parent::handle($args);
261 + function handle($args) {
262 + parent::handle($args);
263 hunk ./actions/api.php 33
264 - $this->api_action = $this->arg('apiaction');
265 - $method = $this->arg('method');
266 - $argument = $this->arg('argument');
267 + $this->api_action = $this->arg('apiaction');
268 + $method = $this->arg('method');
269 + $argument = $this->arg('argument');
270 hunk ./actions/api.php 37
271 - if (isset($argument)) {
272 - $cmdext = explode('.', $argument);
273 - $this->api_arg = $cmdext[0];
274 - $this->api_method = $method;
275 - $this->content_type = strtolower($cmdext[1]);
277 + if (isset($argument)) {
278 + $cmdext = explode('.', $argument);
279 + $this->api_arg = $cmdext[0];
280 + $this->api_method = $method;
281 + $this->content_type = strtolower($cmdext[1]);
283 hunk ./actions/api.php 44
284 - # Requested format / content-type will be an extension on the method
285 - $cmdext = explode('.', $method);
286 - $this->api_method = $cmdext[0];
287 - $this->content_type = strtolower($cmdext[1]);
289 + # Requested format / content-type will be an extension on the method
290 + $cmdext = explode('.', $method);
291 + $this->api_method = $cmdext[0];
292 + $this->content_type = strtolower($cmdext[1]);
294 hunk ./actions/api.php 50
295 - if ($this->requires_auth()) {
296 - if (!isset($_SERVER['PHP_AUTH_USER'])) {
297 + if ($this->requires_auth()) {
298 + if (!isset($_SERVER['PHP_AUTH_USER'])) {
299 hunk ./actions/api.php 53
300 - # This header makes basic auth go
301 - header('WWW-Authenticate: Basic realm="Laconica API"');
302 + # This header makes basic auth go
303 + header('WWW-Authenticate: Basic realm="Laconica API"');
304 hunk ./actions/api.php 56
305 - # If the user hits cancel -- bam!
306 - $this->show_basic_auth_error();
308 - $nickname = $_SERVER['PHP_AUTH_USER'];
309 - $password = $_SERVER['PHP_AUTH_PW'];
310 - $user = common_check_user($nickname, $password);
311 + # If the user hits cancel -- bam!
312 + $this->show_basic_auth_error();
314 + $nickname = $_SERVER['PHP_AUTH_USER'];
315 + $password = $_SERVER['PHP_AUTH_PW'];
316 + $user = common_check_user($nickname, $password);
317 hunk ./actions/api.php 63
319 - $this->user = $user;
320 - $this->process_command();
322 - # basic authentication failed
323 - $this->show_basic_auth_error();
328 + $this->user = $user;
329 + $this->process_command();
331 + # basic authentication failed
332 + $this->show_basic_auth_error();
336 hunk ./actions/api.php 73
337 - # Look for the user in the session
338 - if (common_logged_in()) {
339 - $this->user = common_current_user();
341 + # Look for the user in the session
342 + if (common_logged_in()) {
343 + $this->user = common_current_user();
345 hunk ./actions/api.php 78
346 - $this->process_command();
349 + $this->process_command();
352 hunk ./actions/api.php 82
353 - function process_command() {
354 - $action = "twitapi$this->api_action";
355 - $actionfile = INSTALLDIR."/actions/$action.php";
356 + function process_command() {
357 + $action = "twitapi$this->api_action";
358 + $actionfile = INSTALLDIR."/actions/$action.php";
359 hunk ./actions/api.php 86
360 - if (file_exists($actionfile)) {
361 - require_once($actionfile);
362 - $action_class = ucfirst($action)."Action";
363 - $action_obj = new $action_class();
364 + if (file_exists($actionfile)) {
365 + require_once($actionfile);
366 + $action_class = ucfirst($action)."Action";
367 + $action_obj = new $action_class();
368 hunk ./actions/api.php 95
369 - if (method_exists($action_obj, $this->api_method)) {
370 - $apidata = array( 'content-type' => $this->content_type,
371 - 'api_method' => $this->api_method,
372 - 'api_arg' => $this->api_arg,
373 - 'user' => $this->user);
374 + if (method_exists($action_obj, $this->api_method)) {
375 + $apidata = array( 'content-type' => $this->content_type,
376 + 'api_method' => $this->api_method,
377 + 'api_arg' => $this->api_arg,
378 + 'user' => $this->user);
379 hunk ./actions/api.php 101
380 - call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata);
382 - common_user_error("API method not found!", $code=404);
385 - common_user_error("API method not found!", $code=404);
388 + call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata);
390 + common_user_error("API method not found!", $code=404);
393 + common_user_error("API method not found!", $code=404);
396 hunk ./actions/api.php 110
397 - # Whitelist of API methods that don't need authentication
398 - function requires_auth() {
399 - static $noauth = array( 'statuses/public_timeline',
403 - 'help/downtime_schedule');
404 + # Whitelist of API methods that don't need authentication
405 + function requires_auth() {
406 + static $noauth = array( 'statuses/public_timeline',
410 + 'help/downtime_schedule');
411 hunk ./actions/api.php 118
412 - static $bareauth = array('statuses/user_timeline',
413 - 'statuses/friends',
414 - 'statuses/followers',
415 - 'favorites/favorites');
416 + static $bareauth = array('statuses/user_timeline',
417 + 'statuses/friends',
418 + 'statuses/followers',
419 + 'favorites/favorites');
420 hunk ./actions/api.php 129
421 - $fullname = "$this->api_action/$this->api_method";
422 + $fullname = "$this->api_action/$this->api_method";
423 hunk ./actions/api.php 131
424 - if (in_array($fullname, $bareauth)) {
425 - # bareauth: only needs auth if without an argument
426 - if ($this->api_arg) {
431 - } else if (in_array($fullname, $noauth)) {
432 - # noauth: never needs auth
435 - # everybody else needs auth
439 + if (in_array($fullname, $bareauth)) {
440 + # bareauth: only needs auth if without an argument
441 + if ($this->api_arg) {
446 + } else if (in_array($fullname, $noauth)) {
447 + # noauth: never needs auth
450 + # everybody else needs auth
454 hunk ./actions/api.php 147
455 - function show_basic_auth_error() {
456 - header('HTTP/1.1 401 Unauthorized');
457 - $msg = 'Could not authenticate you.';
458 + function show_basic_auth_error() {
459 + header('HTTP/1.1 401 Unauthorized');
460 + $msg = 'Could not authenticate you.';
461 hunk ./actions/api.php 151
462 - if ($this->content_type == 'xml') {
463 - header('Content-Type: application/xml; charset=utf-8');
464 - common_start_xml();
465 - common_element_start('hash');
466 - common_element('error', NULL, $msg);
467 - common_element('request', NULL, $_SERVER['REQUEST_URI']);
468 - common_element_end('hash');
470 - } else if ($this->content_type == 'json') {
471 - header('Content-Type: application/json; charset=utf-8');
472 - $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
473 - print(json_encode($error_array));
475 - header('Content-type: text/plain');
479 + if ($this->content_type == 'xml') {
480 + header('Content-Type: application/xml; charset=utf-8');
481 + common_start_xml();
482 + common_element_start('hash');
483 + common_element('error', NULL, $msg);
484 + common_element('request', NULL, $_SERVER['REQUEST_URI']);
485 + common_element_end('hash');
487 + } else if ($this->content_type == 'json') {
488 + header('Content-Type: application/json; charset=utf-8');
489 + $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
490 + print(json_encode($error_array));
492 + header('Content-type: text/plain');
496 hunk ./actions/api.php 169
497 - function is_readonly() {
498 - # NOTE: before handle(), can't use $this->arg
499 - $apiaction = $_REQUEST['apiaction'];
500 - $method = $_REQUEST['method'];
501 - list($cmdtext, $fmt) = explode('.', $method);
502 + function is_readonly() {
503 + # NOTE: before handle(), can't use $this->arg
504 + $apiaction = $_REQUEST['apiaction'];
505 + $method = $_REQUEST['method'];
506 + list($cmdtext, $fmt) = explode('.', $method);
507 hunk ./actions/api.php 175
508 - static $write_methods = array(
509 - 'account' => array('update_location', 'update_delivery_device', 'end_session'),
510 - 'blocks' => array('create', 'destroy'),
511 - 'direct_messages' => array('create', 'destroy'),
512 - 'favorites' => array('create', 'destroy'),
513 - 'friendships' => array('create', 'destroy'),
515 - 'notifications' => array('follow', 'leave'),
516 - 'statuses' => array('update', 'destroy'),
519 + static $write_methods = array(
520 + 'account' => array('update_location', 'update_delivery_device', 'end_session'),
521 + 'blocks' => array('create', 'destroy'),
522 + 'direct_messages' => array('create', 'destroy'),
523 + 'favorites' => array('create', 'destroy'),
524 + 'friendships' => array('create', 'destroy'),
526 + 'notifications' => array('follow', 'leave'),
527 + 'statuses' => array('update', 'destroy'),
530 hunk ./actions/api.php 187
531 - if (array_key_exists($apiaction, $write_methods)) {
532 - if (!in_array($cmdtext, $write_methods[$apiaction])) {
536 + if (array_key_exists($apiaction, $write_methods)) {
537 + if (!in_array($cmdtext, $write_methods[$apiaction])) {
541 hunk ./actions/api.php 193
546 hunk ./actions/avatarbynickname.php 27
547 - $this->client_error(_('No nickname.'));
550 - $size = $this->trimmed('size');
551 + $this->client_error(_('No nickname.'));
554 + $size = $this->trimmed('size');
555 hunk ./actions/avatarbynickname.php 32
556 - $this->client_error(_('No size.'));
559 - $size = strtolower($size);
560 - if (!in_array($size, array('original', '96', '48', '24'))) {
561 - $this->client_error(_('Invalid size.'));
564 + $this->client_error(_('No size.'));
567 + $size = strtolower($size);
568 + if (!in_array($size, array('original', '96', '48', '24'))) {
569 + $this->client_error(_('Invalid size.'));
572 hunk ./actions/avatarbynickname.php 41
573 - $user = User::staticGet('nickname', $nickname);
575 - $this->client_error(_('No such user.'));
578 - $profile = $user->getProfile();
580 - $this->client_error(_('User has no profile.'));
583 - if ($size == 'original') {
584 - $avatar = $profile->getOriginal();
586 - $avatar = $profile->getAvatar($size+0);
588 + $user = User::staticGet('nickname', $nickname);
590 + $this->client_error(_('No such user.'));
593 + $profile = $user->getProfile();
595 + $this->client_error(_('User has no profile.'));
598 + if ($size == 'original') {
599 + $avatar = $profile->getOriginal();
601 + $avatar = $profile->getAvatar($size+0);
603 hunk ./actions/avatarbynickname.php 57
605 - $url = $avatar->url;
607 - if ($size == 'original') {
608 - $url = common_default_avatar(AVATAR_PROFILE_SIZE);
610 - $url = common_default_avatar($size+0);
613 - common_redirect($url, 302);
616 + $url = $avatar->url;
618 + if ($size == 'original') {
619 + $url = common_default_avatar(AVATAR_PROFILE_SIZE);
621 + $url = common_default_avatar($size+0);
624 + common_redirect($url, 302);
626 hunk ./actions/block.php 35
627 - $token = $this->trimmed('token');
628 + $token = $this->trimmed('token');
629 hunk ./actions/block.php 37
630 - if (!$token || $token != common_session_token()) {
631 - $this->client_error(_('There was a problem with your session token. Try again, please.'));
634 + if (!$token || $token != common_session_token()) {
635 + $this->client_error(_('There was a problem with your session token. Try again, please.'));
638 hunk ./actions/block.php 78
639 - common_show_header(_('Block user'));
640 + common_show_header(_('Block user'));
641 hunk ./actions/confirmaddress.php 46
642 - $type = $confirm->address_type;
643 - if (!in_array($type, array('email', 'jabber', 'sms'))) {
644 - $this->server_error(sprintf(_('Unrecognized address type %s'), $type));
647 + $type = $confirm->address_type;
648 + if (!in_array($type, array('email', 'jabber', 'sms'))) {
649 + $this->server_error(sprintf(_('Unrecognized address type %s'), $type));
652 hunk ./actions/confirmaddress.php 53
657 hunk ./actions/confirmaddress.php 60
658 - $cur->$type = $confirm->address;
659 + $cur->$type = $confirm->address;
660 hunk ./actions/confirmaddress.php 62
661 - if ($type == 'sms') {
662 - $cur->carrier = ($confirm->address_extra)+0;
663 - $carrier = Sms_carrier::staticGet($cur->carrier);
664 - $cur->smsemail = $carrier->toEmailAddress($cur->sms);
666 + if ($type == 'sms') {
667 + $cur->carrier = ($confirm->address_extra)+0;
668 + $carrier = Sms_carrier::staticGet($cur->carrier);
669 + $cur->smsemail = $carrier->toEmailAddress($cur->sms);
671 hunk ./actions/confirmaddress.php 68
672 - $result = $cur->updateKeys($orig_user);
673 + $result = $cur->updateKeys($orig_user);
674 hunk ./actions/confirmaddress.php 71
675 - common_log_db_error($cur, 'UPDATE', __FILE__);
676 + common_log_db_error($cur, 'UPDATE', __FILE__);
677 hunk ./actions/confirmaddress.php 76
678 - if ($type == 'email') {
679 - $cur->emailChanged();
681 + if ($type == 'email') {
682 + $cur->emailChanged();
684 hunk ./actions/confirmaddress.php 83
685 - common_log_db_error($confirm, 'DELETE', __FILE__);
686 + common_log_db_error($confirm, 'DELETE', __FILE__);
687 hunk ./actions/deletenotice.php 25
688 - function handle($args) {
689 - parent::handle($args);
691 + function handle($args) {
692 + parent::handle($args);
694 hunk ./actions/deletenotice.php 29
695 - if ($_SERVER['REQUEST_METHOD'] == 'POST') {
696 - $this->delete_notice();
697 - } else if ($_SERVER['REQUEST_METHOD'] == 'GET') {
698 - $this->show_form();
701 + if ($_SERVER['REQUEST_METHOD'] == 'POST') {
702 + $this->delete_notice();
703 + } else if ($_SERVER['REQUEST_METHOD'] == 'GET') {
704 + $this->show_form();
707 hunk ./actions/deletenotice.php 36
708 - function get_instructions() {
709 - return _('You are about to permanently delete a notice. Once this is done, it cannot be undone.');
711 + function get_instructions() {
712 + return _('You are about to permanently delete a notice. Once this is done, it cannot be undone.');
714 hunk ./actions/deletenotice.php 40
715 - function get_title() {
716 - return _('Delete notice');
718 + function get_title() {
719 + return _('Delete notice');
721 hunk ./actions/deletenotice.php 44
722 - function show_form($error=NULL) {
723 - $user = common_current_user();
724 + function show_form($error=NULL) {
725 + $user = common_current_user();
726 hunk ./actions/deletenotice.php 47
727 - common_show_header($this->get_title(), array($this, 'show_header'), $error,
728 - array($this, 'show_top'));
729 - common_element_start('form', array('id' => 'notice_delete_form',
730 - 'method' => 'post',
731 - 'action' => common_local_url('deletenotice')));
732 - common_hidden('token', common_session_token());
733 - common_hidden('notice', $this->trimmed('notice'));
734 - common_element_start('p');
735 - common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
736 + common_show_header($this->get_title(), array($this, 'show_header'), $error,
737 + array($this, 'show_top'));
738 + common_element_start('form', array('id' => 'notice_delete_form',
739 + 'method' => 'post',
740 + 'action' => common_local_url('deletenotice')));
741 + common_hidden('token', common_session_token());
742 + common_hidden('notice', $this->trimmed('notice'));
743 + common_element_start('p');
744 + common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
745 hunk ./actions/deletenotice.php 57
746 - common_element('input', array('id' => 'submit_no',
747 - 'name' => 'submit',
748 - 'type' => 'submit',
749 - 'value' => _('No')));
750 - common_element('input', array('id' => 'submit_yes',
751 - 'name' => 'submit',
752 - 'type' => 'submit',
753 - 'value' => _('Yes')));
754 - common_element_end('p');
755 - common_element_end('form');
756 - common_show_footer();
758 + common_element('input', array('id' => 'submit_no',
759 + 'name' => 'submit',
760 + 'type' => 'submit',
761 + 'value' => _('No')));
762 + common_element('input', array('id' => 'submit_yes',
763 + 'name' => 'submit',
764 + 'type' => 'submit',
765 + 'value' => _('Yes')));
766 + common_element_end('p');
767 + common_element_end('form');
768 + common_show_footer();
770 hunk ./actions/deletenotice.php 70
771 - function delete_notice() {
773 - $token = $this->trimmed('token');
774 - if (!$token || $token != common_session_token()) {
775 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
778 - $url = common_get_returnto();
779 - $confirmed = $this->trimmed('submit');
780 - if ($confirmed == _('Yes')) {
781 - $user = common_current_user();
782 - $notice_id = $this->trimmed('notice');
783 - $notice = Notice::staticGet($notice_id);
784 - $replies = new Reply;
785 - $replies->get('notice_id', $notice_id);
786 + function delete_notice() {
788 + $token = $this->trimmed('token');
789 + if (!$token || $token != common_session_token()) {
790 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
793 + $url = common_get_returnto();
794 + $confirmed = $this->trimmed('submit');
795 + if ($confirmed == _('Yes')) {
796 + $user = common_current_user();
797 + $notice_id = $this->trimmed('notice');
798 + $notice = Notice::staticGet($notice_id);
799 + $replies = new Reply;
800 + $replies->get('notice_id', $notice_id);
801 hunk ./actions/deletenotice.php 86
802 - common_dequeue_notice($notice);
803 - if (common_config('memcached', 'enabled')) {
804 - $notice->blowSubsCache();
806 - $replies->delete();
810 - common_set_returnto(NULL);
812 - $url = common_local_url('public');
815 - common_redirect($url);
817 + common_dequeue_notice($notice);
818 + if (common_config('memcached', 'enabled')) {
819 + $notice->blowSubsCache();
821 + $replies->delete();
825 + common_set_returnto(NULL);
827 + $url = common_local_url('public');
830 + common_redirect($url);
832 hunk ./actions/deleteprofile.php 35
833 - function get_instructions() {
834 - return _('Export and delete your user information.');
836 + function get_instructions() {
837 + return _('Export and delete your user information.');
839 hunk ./actions/deleteprofile.php 39
840 - function form_header($title, $msg=NULL, $success=false) {
841 - common_show_header($title,
843 - array($msg, $success),
844 - array($this, 'show_top'));
846 + function form_header($title, $msg=NULL, $success=false) {
847 + common_show_header($title,
849 + array($msg, $success),
850 + array($this, 'show_top'));
852 hunk ./actions/deleteprofile.php 46
853 - function show_feeds_list($feeds) {
854 - common_element_start('div', array('class' => 'feedsdel'));
855 - common_element('p', null, 'Feeds:');
856 - common_element_start('ul', array('class' => 'xoxo'));
857 + function show_feeds_list($feeds) {
858 + common_element_start('div', array('class' => 'feedsdel'));
859 + common_element('p', null, 'Feeds:');
860 + common_element_start('ul', array('class' => 'xoxo'));
861 hunk ./actions/deleteprofile.php 51
862 - foreach ($feeds as $key => $value) {
863 - $this->common_feed_item($feeds[$key]);
865 - common_element_end('ul');
866 - common_element_end('div');
868 + foreach ($feeds as $key => $value) {
869 + $this->common_feed_item($feeds[$key]);
871 + common_element_end('ul');
872 + common_element_end('div');
874 hunk ./actions/deleteprofile.php 59
875 - function common_feed_item($feed) {
876 + function common_feed_item($feed) {
877 hunk ./actions/deleteprofile.php 61
878 - $nickname = $user->nickname;
879 + $nickname = $user->nickname;
880 hunk ./actions/deleteprofile.php 63
881 - switch($feed['item']) {
882 - case 'notices': default:
883 - $feed_classname = $feed['type'];
884 - $feed_mimetype = "application/".$feed['type']."+xml";
885 - $feed_title = "$nickname's ".$feed['version']." notice feed";
886 - $feed['textContent'] = "RSS";
888 + switch($feed['item']) {
889 + case 'notices': default:
890 + $feed_classname = $feed['type'];
891 + $feed_mimetype = "application/".$feed['type']."+xml";
892 + $feed_title = "$nickname's ".$feed['version']." notice feed";
893 + $feed['textContent'] = "RSS";
895 hunk ./actions/deleteprofile.php 71
897 - $feed_classname = "foaf";
898 - $feed_mimetype = "application/".$feed['type']."+xml";
899 - $feed_title = "$nickname's FOAF file";
900 - $feed['textContent'] = "FOAF";
903 - common_element_start('li');
904 - common_element('a', array('href' => $feed['href'],
905 - 'class' => $feed_classname,
906 - 'type' => $feed_mimetype,
907 - 'title' => $feed_title),
908 - $feed['textContent']);
909 - common_element_end('li');
912 + $feed_classname = "foaf";
913 + $feed_mimetype = "application/".$feed['type']."+xml";
914 + $feed_title = "$nickname's FOAF file";
915 + $feed['textContent'] = "FOAF";
918 + common_element_start('li');
919 + common_element('a', array('href' => $feed['href'],
920 + 'class' => $feed_classname,
921 + 'type' => $feed_mimetype,
922 + 'title' => $feed_title),
923 + $feed['textContent']);
924 + common_element_end('li');
926 hunk ./actions/deleteprofile.php 87
927 - function show_form($msg=NULL, $success=false) {
928 - $this->form_header(_('Delete my account'), $msg, $success);
929 - common_element('h2', NULL, _('Delete my account confirmation'));
930 - $this->show_confirm_delete_form();
931 - common_show_footer();
933 + function show_form($msg=NULL, $success=false) {
934 + $this->form_header(_('Delete my account'), $msg, $success);
935 + common_element('h2', NULL, _('Delete my account confirmation'));
936 + $this->show_confirm_delete_form();
937 + common_show_footer();
939 hunk ./actions/deleteprofile.php 94
940 - function show_confirm_delete_form() {
941 - $user = common_current_user();
942 + function show_confirm_delete_form() {
943 + $user = common_current_user();
944 hunk ./actions/deleteprofile.php 100
945 - common_element_start('form', array('method' => 'POST',
948 - common_local_url('deleteprofile')));
949 + common_element_start('form', array('method' => 'POST',
952 + common_local_url('deleteprofile')));
953 hunk ./actions/deleteprofile.php 105
954 - common_hidden('token', common_session_token());
955 + common_hidden('token', common_session_token());
956 hunk ./actions/deleteprofile.php 108
957 - $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
959 - 'version' => 'RSS 1.0',
960 - 'item' => 'notices'),
961 - 1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
963 - 'version' => 'FOAF',
964 - 'item' => 'foaf')));
965 + $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
967 + 'version' => 'RSS 1.0',
968 + 'item' => 'notices'),
969 + 1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
971 + 'version' => 'FOAF',
972 + 'item' => 'foaf')));
973 hunk ./actions/deleteprofile.php 119
974 - common_submit('deleteaccount', _('Delete my account'));
975 - common_element_end('form');
976 + common_submit('deleteaccount', _('Delete my account'));
977 + common_element_end('form');
978 hunk ./actions/deleteprofile.php 123
979 - function handle_post() {
981 - $token = $this->trimmed('token');
982 - if (!$token || $token != common_session_token()) {
983 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
986 + function handle_post() {
988 + $token = $this->trimmed('token');
989 + if (!$token || $token != common_session_token()) {
990 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
993 hunk ./actions/deleteprofile.php 137
994 - function delete_account() {
995 - $user = common_current_user();
996 - assert(!is_null($user)); # should already be checked
997 + function delete_account() {
998 + $user = common_current_user();
999 + assert(!is_null($user)); # should already be checked
1000 hunk ./actions/deleteprofile.php 222
1001 - function show_top($arr) {
1003 - $success = $arr[1];
1005 - $this->message($msg, $success);
1007 - $inst = $this->get_instructions();
1008 - $output = common_markup_to_html($inst);
1009 - common_element_start('div', 'instructions');
1010 - common_raw($output);
1011 - common_element_end('div');
1013 - $this->settings_menu();
1015 + function show_top($arr) {
1017 + $success = $arr[1];
1019 + $this->message($msg, $success);
1021 + $inst = $this->get_instructions();
1022 + $output = common_markup_to_html($inst);
1023 + common_element_start('div', 'instructions');
1024 + common_raw($output);
1025 + common_element_end('div');
1027 + $this->settings_menu();
1029 hunk ./actions/deleteprofile.php 239
1031 - array('profilesettings' =>
1032 - array(_('Profile'),
1033 - _('Change your profile settings')),
1034 - 'emailsettings' =>
1036 - _('Change email handling')),
1037 - 'openidsettings' =>
1038 - array(_('OpenID'),
1039 - _('Add or remove OpenIDs')),
1042 - _('Updates by SMS')),
1045 - _('Updates by instant messenger (IM)')),
1046 - 'twittersettings' =>
1047 - array(_('Twitter'),
1048 - _('Twitter integration options')),
1049 - 'othersettings' =>
1051 - _('Other options')));
1053 + array('profilesettings' =>
1054 + array(_('Profile'),
1055 + _('Change your profile settings')),
1056 + 'emailsettings' =>
1058 + _('Change email handling')),
1059 + 'openidsettings' =>
1060 + array(_('OpenID'),
1061 + _('Add or remove OpenIDs')),
1064 + _('Updates by SMS')),
1067 + _('Updates by instant messenger (IM)')),
1068 + 'twittersettings' =>
1069 + array(_('Twitter'),
1070 + _('Twitter integration options')),
1071 + 'othersettings' =>
1073 + _('Other options')));
1074 hunk ./actions/deleteprofile.php 265
1075 - if ($menuaction == 'imsettings' &&
1076 - !common_config('xmpp', 'enabled')) {
1079 + if ($menuaction == 'imsettings' &&
1080 + !common_config('xmpp', 'enabled')) {
1083 hunk ./actions/disfavor.php 24
1084 - function handle($args) {
1085 + function handle($args) {
1086 hunk ./actions/disfavor.php 26
1087 - parent::handle($args);
1088 + parent::handle($args);
1089 hunk ./actions/disfavor.php 28
1090 - if (!common_logged_in()) {
1091 - common_user_error(_('Not logged in.'));
1094 + if (!common_logged_in()) {
1095 + common_user_error(_('Not logged in.'));
1098 hunk ./actions/disfavor.php 33
1099 - $user = common_current_user();
1100 + $user = common_current_user();
1101 hunk ./actions/disfavor.php 35
1102 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
1103 - common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
1106 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
1107 + common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
1110 hunk ./actions/disfavor.php 40
1111 - $id = $this->trimmed('notice');
1112 + $id = $this->trimmed('notice');
1113 hunk ./actions/disfavor.php 42
1114 - $notice = Notice::staticGet($id);
1115 + $notice = Notice::staticGet($id);
1116 hunk ./actions/disfavor.php 44
1117 - $token = $this->trimmed('token-'.$notice->id);
1118 + $token = $this->trimmed('token-'.$notice->id);
1119 hunk ./actions/disfavor.php 46
1120 - if (!$token || $token != common_session_token()) {
1121 - $this->client_error(_("There was a problem with your session token. Try again, please."));
1124 + if (!$token || $token != common_session_token()) {
1125 + $this->client_error(_("There was a problem with your session token. Try again, please."));
1128 hunk ./actions/disfavor.php 51
1129 - $fave = new Fave();
1130 - $fave->user_id = $this->id;
1131 - $fave->notice_id = $notice->id;
1132 - if (!$fave->find(true)) {
1133 - $this->client_error(_('This notice is not a favorite!'));
1136 + $fave = new Fave();
1137 + $fave->user_id = $this->id;
1138 + $fave->notice_id = $notice->id;
1139 + if (!$fave->find(true)) {
1140 + $this->client_error(_('This notice is not a favorite!'));
1143 hunk ./actions/disfavor.php 59
1144 - $result = $fave->delete();
1145 + $result = $fave->delete();
1146 hunk ./actions/disfavor.php 61
1148 - common_log_db_error($fave, 'DELETE', __FILE__);
1149 - $this->server_error(_('Could not delete favorite.'));
1153 - $user->blowFavesCache();
1155 + common_log_db_error($fave, 'DELETE', __FILE__);
1156 + $this->server_error(_('Could not delete favorite.'));
1160 + $user->blowFavesCache();
1161 hunk ./actions/disfavor.php 69
1162 - if ($this->boolean('ajax')) {
1163 - common_start_html('text/xml;charset=utf-8', true);
1164 - common_element_start('head');
1165 - common_element('title', null, _('Add to favorites'));
1166 - common_element_end('head');
1167 - common_element_start('body');
1168 - common_favor_form($notice);
1169 - common_element_end('body');
1170 - common_element_end('html');
1172 - common_redirect(common_local_url('showfavorites',
1173 - array('nickname' => $user->nickname)));
1176 + if ($this->boolean('ajax')) {
1177 + common_start_html('text/xml;charset=utf-8', true);
1178 + common_element_start('head');
1179 + common_element('title', null, _('Add to favorites'));
1180 + common_element_end('head');
1181 + common_element_start('body');
1182 + common_favor_form($notice);
1183 + common_element_end('body');
1184 + common_element_end('html');
1186 + common_redirect(common_local_url('showfavorites',
1187 + array('nickname' => $user->nickname)));
1190 hunk ./actions/doc.php 24
1191 - function handle($args) {
1192 - parent::handle($args);
1193 - $title = $this->trimmed('title');
1194 - $filename = INSTALLDIR.'/doc/'.$title;
1195 - if (!file_exists($filename)) {
1196 - common_user_error(_('No such document.'));
1199 - $c = file_get_contents($filename);
1200 - $output = common_markup_to_html($c);
1201 - common_show_header(_(ucfirst($title)));
1202 - common_raw($output);
1203 - common_show_footer();
1205 + function handle($args) {
1206 + parent::handle($args);
1207 + $title = $this->trimmed('title');
1208 + $filename = INSTALLDIR.'/doc/'.$title;
1209 + if (!file_exists($filename)) {
1210 + common_user_error(_('No such document.'));
1213 + $c = file_get_contents($filename);
1214 + $output = common_markup_to_html($c);
1215 + common_show_header(_(ucfirst($title)));
1216 + common_raw($output);
1217 + common_show_footer();
1219 hunk ./actions/emailsettings.php 26
1220 - function get_instructions() {
1221 - return _('Manage how you get email from %%site.name%%.');
1223 + function get_instructions() {
1224 + return _('Manage how you get email from %%site.name%%.');
1226 hunk ./actions/emailsettings.php 30
1227 - function show_form($msg=NULL, $success=false) {
1228 - $user = common_current_user();
1229 - $this->form_header(_('Email Settings'), $msg, $success);
1230 - common_element_start('form', array('method' => 'post',
1231 - 'id' => 'emailsettings',
1233 - common_local_url('emailsettings')));
1234 - common_hidden('token', common_session_token());
1235 + function show_form($msg=NULL, $success=false) {
1236 + $user = common_current_user();
1237 + $this->form_header(_('Email Settings'), $msg, $success);
1238 + common_element_start('form', array('method' => 'post',
1239 + 'id' => 'emailsettings',
1241 + common_local_url('emailsettings')));
1242 + common_hidden('token', common_session_token());
1243 hunk ./actions/emailsettings.php 39
1244 - common_element('h2', NULL, _('Address'));
1245 + common_element('h2', NULL, _('Address'));
1246 hunk ./actions/emailsettings.php 41
1247 - if ($user->email) {
1248 - common_element_start('p');
1249 - common_element('span', 'address confirmed', $user->email);
1250 - common_element('span', 'input_instructions',
1251 - _('Current confirmed email address.'));
1252 - common_hidden('email', $user->email);
1253 - common_element_end('p');
1254 - common_submit('remove', _('Remove'));
1256 - $confirm = $this->get_confirmation();
1258 - common_element_start('p');
1259 - common_element('span', 'address unconfirmed', $confirm->address);
1260 - common_element('span', 'input_instructions',
1261 - _('Awaiting confirmation on this address. Check your inbox (and spam box!) for a message with further instructions.'));
1262 - common_hidden('email', $confirm->address);
1263 - common_element_end('p');
1264 - common_submit('cancel', _('Cancel'));
1266 - common_input('email', _('Email Address'),
1267 - ($this->arg('email')) ? $this->arg('email') : NULL,
1268 - _('Email address, like "UserName@example.org"'));
1269 - common_submit('add', _('Add'));
1272 + if ($user->email) {
1273 + common_element_start('p');
1274 + common_element('span', 'address confirmed', $user->email);
1275 + common_element('span', 'input_instructions',
1276 + _('Current confirmed email address.'));
1277 + common_hidden('email', $user->email);
1278 + common_element_end('p');
1279 + common_submit('remove', _('Remove'));
1281 + $confirm = $this->get_confirmation();
1283 + common_element_start('p');
1284 + common_element('span', 'address unconfirmed', $confirm->address);
1285 + common_element('span', 'input_instructions',
1286 + _('Awaiting confirmation on this address. Check your inbox (and spam box!) for a message with further instructions.'));
1287 + common_hidden('email', $confirm->address);
1288 + common_element_end('p');
1289 + common_submit('cancel', _('Cancel'));
1291 + common_input('email', _('Email Address'),
1292 + ($this->arg('email')) ? $this->arg('email') : NULL,
1293 + _('Email address, like "UserName@example.org"'));
1294 + common_submit('add', _('Add'));
1297 hunk ./actions/emailsettings.php 67
1298 - if ($user->email) {
1299 - common_element('h2', NULL, _('Incoming email'));
1301 - if ($user->incomingemail) {
1302 - common_element_start('p');
1303 - common_element('span', 'address', $user->incomingemail);
1304 - common_element('span', 'input_instructions',
1305 - _('Send email to this address to post new notices.'));
1306 - common_element_end('p');
1307 - common_submit('removeincoming', _('Remove'));
1310 - common_element_start('p');
1311 - common_element('span', 'input_instructions',
1312 - _('Make a new email address for posting to; cancels the old one.'));
1313 - common_element_end('p');
1314 - common_submit('newincoming', _('New'));
1317 - common_element('h2', NULL, _('Preferences'));
1318 + if ($user->email) {
1319 + common_element('h2', NULL, _('Incoming email'));
1321 + if ($user->incomingemail) {
1322 + common_element_start('p');
1323 + common_element('span', 'address', $user->incomingemail);
1324 + common_element('span', 'input_instructions',
1325 + _('Send email to this address to post new notices.'));
1326 + common_element_end('p');
1327 + common_submit('removeincoming', _('Remove'));
1330 + common_element_start('p');
1331 + common_element('span', 'input_instructions',
1332 + _('Make a new email address for posting to; cancels the old one.'));
1333 + common_element_end('p');
1334 + common_submit('newincoming', _('New'));
1337 + common_element('h2', NULL, _('Preferences'));
1338 hunk ./actions/emailsettings.php 88
1339 - common_checkbox('emailnotifysub',
1340 - _('Send me notices of new subscriptions through email.'),
1341 - $user->emailnotifysub);
1342 - common_checkbox('emailnotifyfav',
1343 - _('Send me email when someone adds my notice as a favorite.'),
1344 - $user->emailnotifyfav);
1345 - common_checkbox('emailnotifymsg',
1346 - _('Send me email when someone sends me a private message.'),
1347 - $user->emailnotifymsg);
1348 - common_checkbox('emailnotifynudge',
1349 - _('Allow friends to nudge me and send me an email.'),
1350 - $user->emailnotifynudge);
1351 - common_checkbox('emailpost',
1352 - _('I want to post notices by email.'),
1353 - $user->emailpost);
1354 - common_checkbox('emailmicroid',
1355 - _('Publish a MicroID for my email address.'),
1356 - $user->emailmicroid);
1357 + common_checkbox('emailnotifysub',
1358 + _('Send me notices of new subscriptions through email.'),
1359 + $user->emailnotifysub);
1360 + common_checkbox('emailnotifyfav',
1361 + _('Send me email when someone adds my notice as a favorite.'),
1362 + $user->emailnotifyfav);
1363 + common_checkbox('emailnotifymsg',
1364 + _('Send me email when someone sends me a private message.'),
1365 + $user->emailnotifymsg);
1366 + common_checkbox('emailnotifynudge',
1367 + _('Allow friends to nudge me and send me an email.'),
1368 + $user->emailnotifynudge);
1369 + common_checkbox('emailpost',
1370 + _('I want to post notices by email.'),
1371 + $user->emailpost);
1372 + common_checkbox('emailmicroid',
1373 + _('Publish a MicroID for my email address.'),
1374 + $user->emailmicroid);
1375 hunk ./actions/emailsettings.php 107
1376 - common_submit('save', _('Save'));
1378 - common_element_end('form');
1379 - common_show_footer();
1381 + common_submit('save', _('Save'));
1383 + common_element_end('form');
1384 + common_show_footer();
1386 hunk ./actions/emailsettings.php 113
1387 - function get_confirmation() {
1388 - $user = common_current_user();
1389 - $confirm = new Confirm_address();
1390 - $confirm->user_id = $user->id;
1391 - $confirm->address_type = 'email';
1392 - if ($confirm->find(TRUE)) {
1398 + function get_confirmation() {
1399 + $user = common_current_user();
1400 + $confirm = new Confirm_address();
1401 + $confirm->user_id = $user->id;
1402 + $confirm->address_type = 'email';
1403 + if ($confirm->find(TRUE)) {
1409 hunk ./actions/emailsettings.php 125
1410 - function handle_post() {
1411 + function handle_post() {
1412 hunk ./actions/emailsettings.php 127
1414 - $token = $this->trimmed('token');
1415 - if (!$token || $token != common_session_token()) {
1416 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
1420 + $token = $this->trimmed('token');
1421 + if (!$token || $token != common_session_token()) {
1422 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
1425 hunk ./actions/emailsettings.php 134
1426 - if ($this->arg('save')) {
1427 - $this->save_preferences();
1428 - } else if ($this->arg('add')) {
1429 - $this->add_address();
1430 - } else if ($this->arg('cancel')) {
1431 - $this->cancel_confirmation();
1432 - } else if ($this->arg('remove')) {
1433 - $this->remove_address();
1434 - } else if ($this->arg('removeincoming')) {
1435 - $this->remove_incoming();
1436 - } else if ($this->arg('newincoming')) {
1437 - $this->new_incoming();
1439 - $this->show_form(_('Unexpected form submission.'));
1442 + if ($this->arg('save')) {
1443 + $this->save_preferences();
1444 + } else if ($this->arg('add')) {
1445 + $this->add_address();
1446 + } else if ($this->arg('cancel')) {
1447 + $this->cancel_confirmation();
1448 + } else if ($this->arg('remove')) {
1449 + $this->remove_address();
1450 + } else if ($this->arg('removeincoming')) {
1451 + $this->remove_incoming();
1452 + } else if ($this->arg('newincoming')) {
1453 + $this->new_incoming();
1455 + $this->show_form(_('Unexpected form submission.'));
1458 hunk ./actions/emailsettings.php 151
1459 - function save_preferences() {
1460 + function save_preferences() {
1461 hunk ./actions/emailsettings.php 153
1462 - $emailnotifysub = $this->boolean('emailnotifysub');
1463 - $emailnotifyfav = $this->boolean('emailnotifyfav');
1464 - $emailnotifymsg = $this->boolean('emailnotifymsg');
1465 - $emailnotifynudge = $this->boolean('emailnotifynudge');
1466 - $emailmicroid = $this->boolean('emailmicroid');
1467 - $emailpost = $this->boolean('emailpost');
1468 + $emailnotifysub = $this->boolean('emailnotifysub');
1469 + $emailnotifyfav = $this->boolean('emailnotifyfav');
1470 + $emailnotifymsg = $this->boolean('emailnotifymsg');
1471 + $emailnotifynudge = $this->boolean('emailnotifynudge');
1472 + $emailmicroid = $this->boolean('emailmicroid');
1473 + $emailpost = $this->boolean('emailpost');
1474 hunk ./actions/emailsettings.php 160
1475 - $user = common_current_user();
1476 + $user = common_current_user();
1477 hunk ./actions/emailsettings.php 162
1478 - assert(!is_null($user)); # should already be checked
1479 + assert(!is_null($user)); # should already be checked
1480 hunk ./actions/emailsettings.php 164
1481 - $user->query('BEGIN');
1482 + $user->query('BEGIN');
1483 hunk ./actions/emailsettings.php 166
1484 - $original = clone($user);
1485 + $original = clone($user);
1486 hunk ./actions/emailsettings.php 168
1487 - $user->emailnotifysub = $emailnotifysub;
1488 - $user->emailnotifyfav = $emailnotifyfav;
1489 - $user->emailnotifymsg = $emailnotifymsg;
1490 - $user->emailnotifynudge = $emailnotifynudge;
1491 - $user->emailmicroid = $emailmicroid;
1492 - $user->emailpost = $emailpost;
1493 + $user->emailnotifysub = $emailnotifysub;
1494 + $user->emailnotifyfav = $emailnotifyfav;
1495 + $user->emailnotifymsg = $emailnotifymsg;
1496 + $user->emailnotifynudge = $emailnotifynudge;
1497 + $user->emailmicroid = $emailmicroid;
1498 + $user->emailpost = $emailpost;
1499 hunk ./actions/emailsettings.php 175
1500 - $result = $user->update($original);
1501 + $result = $user->update($original);
1502 hunk ./actions/emailsettings.php 177
1503 - if ($result === FALSE) {
1504 - common_log_db_error($user, 'UPDATE', __FILE__);
1505 - common_server_error(_('Couldn\'t update user.'));
1508 + if ($result === FALSE) {
1509 + common_log_db_error($user, 'UPDATE', __FILE__);
1510 + common_server_error(_('Couldn\'t update user.'));
1513 hunk ./actions/emailsettings.php 183
1514 - $user->query('COMMIT');
1515 + $user->query('COMMIT');
1516 hunk ./actions/emailsettings.php 185
1517 - $this->show_form(_('Preferences saved.'), true);
1519 + $this->show_form(_('Preferences saved.'), true);
1521 hunk ./actions/emailsettings.php 188
1522 - function add_address() {
1523 + function add_address() {
1524 hunk ./actions/emailsettings.php 190
1525 - $user = common_current_user();
1526 + $user = common_current_user();
1527 hunk ./actions/emailsettings.php 192
1528 - $email = $this->trimmed('email');
1529 + $email = $this->trimmed('email');
1530 hunk ./actions/emailsettings.php 194
1533 hunk ./actions/emailsettings.php 196
1535 - $this->show_form(_('No email address.'));
1539 + $this->show_form(_('No email address.'));
1542 hunk ./actions/emailsettings.php 201
1543 - $email = common_canonical_email($email);
1544 + $email = common_canonical_email($email);
1545 hunk ./actions/emailsettings.php 203
1547 - $this->show_form(_('Cannot normalize that email address'));
1550 - if (!Validate::email($email, true)) {
1551 - $this->show_form(_('Not a valid email address'));
1553 - } else if ($user->email == $email) {
1554 - $this->show_form(_('That is already your email address.'));
1556 - } else if ($this->email_exists($email)) {
1557 - $this->show_form(_('That email address already belongs to another user.'));
1561 + $this->show_form(_('Cannot normalize that email address'));
1564 + if (!Validate::email($email, true)) {
1565 + $this->show_form(_('Not a valid email address'));
1567 + } else if ($user->email == $email) {
1568 + $this->show_form(_('That is already your email address.'));
1570 + } else if ($this->email_exists($email)) {
1571 + $this->show_form(_('That email address already belongs to another user.'));
1574 hunk ./actions/emailsettings.php 218
1575 - $confirm = new Confirm_address();
1576 - $confirm->address = $email;
1577 - $confirm->address_type = 'email';
1578 - $confirm->user_id = $user->id;
1579 - $confirm->code = common_confirmation_code(64);
1580 + $confirm = new Confirm_address();
1581 + $confirm->address = $email;
1582 + $confirm->address_type = 'email';
1583 + $confirm->user_id = $user->id;
1584 + $confirm->code = common_confirmation_code(64);
1585 hunk ./actions/emailsettings.php 224
1586 - $result = $confirm->insert();
1587 + $result = $confirm->insert();
1588 hunk ./actions/emailsettings.php 226
1589 - if ($result === FALSE) {
1590 - common_log_db_error($confirm, 'INSERT', __FILE__);
1591 - common_server_error(_('Couldn\'t insert confirmation code.'));
1594 + if ($result === FALSE) {
1595 + common_log_db_error($confirm, 'INSERT', __FILE__);
1596 + common_server_error(_('Couldn\'t insert confirmation code.'));
1599 hunk ./actions/emailsettings.php 232
1600 - mail_confirm_address($user, $confirm->code, $user->nickname, $email);
1601 + mail_confirm_address($user, $confirm->code, $user->nickname, $email);
1602 hunk ./actions/emailsettings.php 234
1603 - $msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
1604 + $msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
1605 hunk ./actions/emailsettings.php 236
1606 - $this->show_form($msg, TRUE);
1608 + $this->show_form($msg, TRUE);
1610 hunk ./actions/emailsettings.php 239
1611 - function cancel_confirmation() {
1612 - $email = $this->arg('email');
1613 - $confirm = $this->get_confirmation();
1615 - $this->show_form(_('No pending confirmation to cancel.'));
1618 - if ($confirm->address != $email) {
1619 - $this->show_form(_('That is the wrong IM address.'));
1622 + function cancel_confirmation() {
1623 + $email = $this->arg('email');
1624 + $confirm = $this->get_confirmation();
1626 + $this->show_form(_('No pending confirmation to cancel.'));
1629 + if ($confirm->address != $email) {
1630 + $this->show_form(_('That is the wrong IM address.'));
1633 hunk ./actions/emailsettings.php 254
1634 - common_log_db_error($confirm, 'DELETE', __FILE__);
1635 + common_log_db_error($confirm, 'DELETE', __FILE__);
1636 hunk ./actions/emailsettings.php 260
1639 hunk ./actions/emailsettings.php 262
1640 - function remove_address() {
1641 + function remove_address() {
1642 hunk ./actions/emailsettings.php 264
1643 - $user = common_current_user();
1644 - $email = $this->arg('email');
1645 + $user = common_current_user();
1646 + $email = $this->arg('email');
1647 hunk ./actions/emailsettings.php 267
1648 - # Maybe an old tab open...?
1649 + # Maybe an old tab open...?
1650 hunk ./actions/emailsettings.php 269
1651 - if ($user->email != $email) {
1652 - $this->show_form(_('That is not your email address.'));
1655 + if ($user->email != $email) {
1656 + $this->show_form(_('That is not your email address.'));
1659 hunk ./actions/emailsettings.php 274
1660 - $user->query('BEGIN');
1661 - $original = clone($user);
1662 - $user->email = NULL;
1663 - $result = $user->updateKeys($original);
1665 - common_log_db_error($user, 'UPDATE', __FILE__);
1666 - common_server_error(_('Couldn\'t update user.'));
1669 - $user->query('COMMIT');
1670 + $user->query('BEGIN');
1671 + $original = clone($user);
1672 + $user->email = NULL;
1673 + $result = $user->updateKeys($original);
1675 + common_log_db_error($user, 'UPDATE', __FILE__);
1676 + common_server_error(_('Couldn\'t update user.'));
1679 + $user->query('COMMIT');
1680 hunk ./actions/emailsettings.php 285
1681 - $this->show_form(_('The address was removed.'), TRUE);
1683 + $this->show_form(_('The address was removed.'), TRUE);
1685 hunk ./actions/emailsettings.php 288
1686 - function remove_incoming() {
1687 - $user = common_current_user();
1689 - if (!$user->incomingemail) {
1690 - $this->show_form(_('No incoming email address.'));
1694 - $orig = clone($user);
1695 - $user->incomingemail = NULL;
1696 + function remove_incoming() {
1697 + $user = common_current_user();
1699 + if (!$user->incomingemail) {
1700 + $this->show_form(_('No incoming email address.'));
1704 + $orig = clone($user);
1705 + $user->incomingemail = NULL;
1706 hunk ./actions/emailsettings.php 299
1707 - if (!$user->updateKeys($orig)) {
1708 - common_log_db_error($user, 'UPDATE', __FILE__);
1709 - $this->server_error(_("Couldn't update user record."));
1712 - $this->show_form(_('Incoming email address removed.'), TRUE);
1714 + if (!$user->updateKeys($orig)) {
1715 + common_log_db_error($user, 'UPDATE', __FILE__);
1716 + $this->server_error(_("Couldn't update user record."));
1719 + $this->show_form(_('Incoming email address removed.'), TRUE);
1721 hunk ./actions/emailsettings.php 307
1722 - function new_incoming() {
1723 - $user = common_current_user();
1725 - $orig = clone($user);
1726 - $user->incomingemail = mail_new_incoming_address();
1728 - if (!$user->updateKeys($orig)) {
1729 - common_log_db_error($user, 'UPDATE', __FILE__);
1730 - $this->server_error(_("Couldn't update user record."));
1732 + function new_incoming() {
1733 + $user = common_current_user();
1735 + $orig = clone($user);
1736 + $user->incomingemail = mail_new_incoming_address();
1738 + if (!$user->updateKeys($orig)) {
1739 + common_log_db_error($user, 'UPDATE', __FILE__);
1740 + $this->server_error(_("Couldn't update user record."));
1742 hunk ./actions/emailsettings.php 318
1743 - $this->show_form(_('New incoming email address added.'), TRUE);
1746 - function email_exists($email) {
1747 - $user = common_current_user();
1748 - $other = User::staticGet('email', $email);
1752 - return $other->id != $user->id;
1755 + $this->show_form(_('New incoming email address added.'), TRUE);
1758 + function email_exists($email) {
1759 + $user = common_current_user();
1760 + $other = User::staticGet('email', $email);
1764 + return $other->id != $user->id;
1767 hunk ./actions/facebookhome.php 13
1768 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1769 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1770 hunk ./actions/facebookhome.php 17
1771 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
1772 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
1773 hunk ./actions/facebookhome.php 26
1774 - function handle($args) {
1775 - parent::handle($args);
1776 + function handle($args) {
1777 + parent::handle($args);
1778 hunk ./actions/facebookhome.php 29
1783 hunk ./actions/facebookhome.php 32
1784 - function login() {
1785 + function login() {
1786 hunk ./actions/facebookhome.php 34
1789 hunk ./actions/facebookhome.php 36
1790 - $facebook = $this->get_facebook();
1791 - $fbuid = $facebook->require_login();
1792 + $facebook = $this->get_facebook();
1793 + $fbuid = $facebook->require_login();
1794 hunk ./actions/facebookhome.php 39
1795 - # check to see whether there's already a Facebook link for this user
1796 - $flink = Foreign_link::getByForeignID($fbuid, 2); // 2 == Facebook
1797 + # check to see whether there's already a Facebook link for this user
1798 + $flink = Foreign_link::getByForeignID($fbuid, 2); // 2 == Facebook
1799 hunk ./actions/facebookhome.php 42
1802 hunk ./actions/facebookhome.php 44
1803 - $user = $flink->getUser();
1804 - $this->show_home($facebook, $fbuid, $user);
1805 + $user = $flink->getUser();
1806 + $this->show_home($facebook, $fbuid, $user);
1807 hunk ./actions/facebookhome.php 47
1810 hunk ./actions/facebookhome.php 49
1811 - # Make the user put in her Laconica creds
1812 - $nickname = common_canonical_nickname($this->trimmed('nickname'));
1813 - $password = $this->arg('password');
1814 + # Make the user put in her Laconica creds
1815 + $nickname = common_canonical_nickname($this->trimmed('nickname'));
1816 + $password = $this->arg('password');
1817 hunk ./actions/facebookhome.php 53
1820 hunk ./actions/facebookhome.php 55
1821 - if (common_check_user($nickname, $password)) {
1822 + if (common_check_user($nickname, $password)) {
1823 hunk ./actions/facebookhome.php 58
1824 - $user = User::staticGet('nickname', $nickname);
1825 + $user = User::staticGet('nickname', $nickname);
1826 hunk ./actions/facebookhome.php 60
1828 - echo '<fb:error message="Coudln\'t get user!" />';
1829 - $this->show_login_form();
1832 + echo '<fb:error message="Coudln\'t get user!" />';
1833 + $this->show_login_form();
1835 hunk ./actions/facebookhome.php 65
1836 - $flink = DB_DataObject::factory('foreign_link');
1837 - $flink->user_id = $user->id;
1838 - $flink->foreign_id = $fbuid;
1839 - $flink->service = 2; # Facebook
1840 - $flink->created = common_sql_now();
1841 + $flink = DB_DataObject::factory('foreign_link');
1842 + $flink->user_id = $user->id;
1843 + $flink->foreign_id = $fbuid;
1844 + $flink->service = 2; # Facebook
1845 + $flink->created = common_sql_now();
1846 hunk ./actions/facebookhome.php 71
1847 - # $this->set_flags($flink, $noticesync, $replysync, $friendsync);
1848 + # $this->set_flags($flink, $noticesync, $replysync, $friendsync);
1849 hunk ./actions/facebookhome.php 73
1850 - $flink_id = $flink->insert();
1851 + $flink_id = $flink->insert();
1852 hunk ./actions/facebookhome.php 75
1854 - echo '<fb:success message="You can now use the Identi.ca from Facebook!" />';
1857 + echo '<fb:success message="You can now use the Identi.ca from Facebook!" />';
1859 hunk ./actions/facebookhome.php 79
1860 - $this->show_home($facebook, $fbuid, $user);
1861 + $this->show_home($facebook, $fbuid, $user);
1862 hunk ./actions/facebookhome.php 81
1865 - echo '<fb:error message="Incorrect username or password." />';
1870 + echo '<fb:error message="Incorrect username or password." />';
1873 hunk ./actions/facebookhome.php 87
1874 - $this->show_login_form();
1876 + $this->show_login_form();
1878 hunk ./actions/facebookhome.php 90
1881 hunk ./actions/facebookhome.php 92
1882 - function show_home($facebook, $fbuid, $user) {
1883 + function show_home($facebook, $fbuid, $user) {
1884 hunk ./actions/facebookhome.php 94
1885 - $this->show_header('Home');
1886 + $this->show_header('Home');
1887 hunk ./actions/facebookhome.php 96
1888 - echo $this->show_notices($user);
1889 - $this->update_profile_box($facebook, $fbuid, $user);
1890 + echo $this->show_notices($user);
1891 + $this->update_profile_box($facebook, $fbuid, $user);
1892 hunk ./actions/facebookhome.php 99
1893 - $this->show_footer();
1895 + $this->show_footer();
1897 hunk ./actions/facebookhome.php 102
1898 - function show_notices($user) {
1899 + function show_notices($user) {
1900 hunk ./actions/facebookhome.php 104
1901 - $page = $this->trimmed('page');
1905 + $page = $this->trimmed('page');
1909 hunk ./actions/facebookhome.php 109
1910 - $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
1911 + $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
1912 hunk ./actions/facebookhome.php 111
1913 - echo '<ul id="notices">';
1914 + echo '<ul id="notices">';
1915 hunk ./actions/facebookhome.php 113
1918 hunk ./actions/facebookhome.php 115
1919 - while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
1921 + while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
1923 hunk ./actions/facebookhome.php 118
1924 - if ($cnt > NOTICES_PER_PAGE) {
1927 + if ($cnt > NOTICES_PER_PAGE) {
1930 hunk ./actions/facebookhome.php 122
1931 - echo $this->render_notice($notice);
1933 + echo $this->render_notice($notice);
1935 hunk ./actions/facebookhome.php 125
1938 hunk ./actions/facebookhome.php 127
1939 - $this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
1940 - $page, 'index.php', array('nickname' => $user->nickname));
1941 + $this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
1942 + $page, 'index.php', array('nickname' => $user->nickname));
1943 hunk ./actions/facebookhome.php 130
1946 hunk ./actions/facebookinvite.php 13
1947 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1948 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1949 hunk ./actions/facebookinvite.php 17
1950 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
1951 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
1952 hunk ./actions/facebookinvite.php 26
1953 - function handle($args) {
1954 - parent::handle($args);
1955 + function handle($args) {
1956 + parent::handle($args);
1957 hunk ./actions/facebookinvite.php 29
1962 hunk ./actions/facebookinvite.php 32
1963 - function display() {
1964 + function display() {
1965 hunk ./actions/facebookinvite.php 34
1966 - $facebook = $this->get_facebook();
1967 + $facebook = $this->get_facebook();
1968 hunk ./actions/facebookinvite.php 36
1969 - $fbuid = $facebook->require_login();
1970 + $fbuid = $facebook->require_login();
1971 hunk ./actions/facebookinvite.php 38
1972 - $this->show_header('Invite');
1973 + $this->show_header('Invite');
1974 hunk ./actions/facebookinvite.php 40
1975 - echo '<h2>Coming soon...</h2>';
1976 + echo '<h2>Coming soon...</h2>';
1977 hunk ./actions/facebookinvite.php 42
1978 - $this->show_footer();
1979 + $this->show_footer();
1980 hunk ./actions/facebookinvite.php 44
1983 hunk ./actions/facebookremove.php 13
1984 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1985 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1986 hunk ./actions/facebookremove.php 17
1987 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
1988 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
1989 hunk ./actions/facebookremove.php 26
1990 - function handle($args) {
1991 - parent::handle($args);
1992 + function handle($args) {
1993 + parent::handle($args);
1994 hunk ./actions/facebookremove.php 29
1995 - $secret = common_config('facebook', 'secret');
1996 + $secret = common_config('facebook', 'secret');
1997 hunk ./actions/facebookremove.php 31
2000 hunk ./actions/facebookremove.php 33
2003 hunk ./actions/facebookremove.php 35
2004 - foreach ($_POST as $key => $val) {
2005 - if (substr($key, 0, 7) == 'fb_sig_') {
2006 - $sig .= substr($key, 7) . '=' . $val;
2009 + foreach ($_POST as $key => $val) {
2010 + if (substr($key, 0, 7) == 'fb_sig_') {
2011 + $sig .= substr($key, 7) . '=' . $val;
2014 hunk ./actions/facebookremove.php 41
2016 - $verify = md5($sig);
2018 + $verify = md5($sig);
2019 hunk ./actions/facebookremove.php 44
2020 - if ($verify == $this->arg('fb_sig')) {
2021 + if ($verify == $this->arg('fb_sig')) {
2022 hunk ./actions/facebookremove.php 46
2023 - $flink = Foreign_link::getByForeignID($this->arg('fb_sig_user'), 2);
2024 + $flink = Foreign_link::getByForeignID($this->arg('fb_sig_user'), 2);
2025 hunk ./actions/facebookremove.php 48
2026 - common_debug("Removing foreign link to Facebook - local user ID: $flink->user_id, Facebook ID: $flink->foreign_id");
2027 + common_debug("Removing foreign link to Facebook - local user ID: $flink->user_id, Facebook ID: $flink->foreign_id");
2028 hunk ./actions/facebookremove.php 50
2029 - $result = $flink->delete();
2030 + $result = $flink->delete();
2031 hunk ./actions/facebookremove.php 52
2033 - common_log_db_error($flink, 'DELETE', __FILE__);
2034 - common_server_error(_('Couldn\'t remove Facebook user.'));
2038 + common_log_db_error($flink, 'DELETE', __FILE__);
2039 + common_server_error(_('Couldn\'t remove Facebook user.'));
2042 hunk ./actions/facebookremove.php 58
2044 - # Someone bad tried to remove facebook link?
2045 - common_log(LOG_ERR, "Someone from $_SERVER[REMOTE_ADDR] " .
2046 - 'unsuccessfully tried to remove a foreign link to Facebook!');
2050 + # Someone bad tried to remove facebook link?
2051 + common_log(LOG_ERR, "Someone from $_SERVER[REMOTE_ADDR] " .
2052 + 'unsuccessfully tried to remove a foreign link to Facebook!');
2055 hunk ./actions/facebooksettings.php 13
2056 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2057 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2058 hunk ./actions/facebooksettings.php 17
2059 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
2060 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
2061 hunk ./actions/facebooksettings.php 26
2062 - function handle($args) {
2063 - parent::handle($args);
2064 + function handle($args) {
2065 + parent::handle($args);
2066 hunk ./actions/facebooksettings.php 29
2071 hunk ./actions/facebooksettings.php 32
2072 - function display() {
2073 + function display() {
2074 hunk ./actions/facebooksettings.php 34
2075 - $facebook = $this->get_facebook();
2076 + $facebook = $this->get_facebook();
2077 hunk ./actions/facebooksettings.php 36
2078 - $fbuid = $facebook->require_login();
2079 + $fbuid = $facebook->require_login();
2080 hunk ./actions/facebooksettings.php 38
2081 - $fbml = '<fb:if-section-not-added section="profile">'
2082 - .'<h2>Add an Identi.ca box to your profile!</h2>'
2083 - .'<fb:add-section-button section="profile"/>'
2084 - .'</fb:if-section-not-added>';
2085 + $fbml = '<fb:if-section-not-added section="profile">'
2086 + .'<h2>Add an Identi.ca box to your profile!</h2>'
2087 + .'<fb:add-section-button section="profile"/>'
2088 + .'</fb:if-section-not-added>';
2089 hunk ./actions/facebooksettings.php 44
2090 - $this->show_header('Settings');
2091 + $this->show_header('Settings');
2092 hunk ./actions/facebooksettings.php 46
2095 hunk ./actions/facebooksettings.php 48
2096 - $this->show_footer();
2097 + $this->show_footer();
2098 hunk ./actions/facebooksettings.php 50
2101 hunk ./actions/favor.php 26
2102 - function handle($args) {
2103 - parent::handle($args);
2104 + function handle($args) {
2105 + parent::handle($args);
2106 hunk ./actions/favor.php 29
2107 - if (!common_logged_in()) {
2108 - common_user_error(_('Not logged in.'));
2111 + if (!common_logged_in()) {
2112 + common_user_error(_('Not logged in.'));
2115 hunk ./actions/favor.php 34
2116 - $user = common_current_user();
2117 + $user = common_current_user();
2118 hunk ./actions/favor.php 36
2119 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
2120 - common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
2123 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
2124 + common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
2127 hunk ./actions/favor.php 41
2128 - $id = $this->trimmed('notice');
2129 + $id = $this->trimmed('notice');
2130 hunk ./actions/favor.php 43
2131 - $notice = Notice::staticGet($id);
2132 + $notice = Notice::staticGet($id);
2133 hunk ./actions/favor.php 45
2136 hunk ./actions/favor.php 47
2137 - $token = $this->trimmed('token-'.$notice->id);
2138 - if (!$token || $token != common_session_token()) {
2139 - $this->client_error(_("There was a problem with your session token. Try again, please."));
2142 + $token = $this->trimmed('token-'.$notice->id);
2143 + if (!$token || $token != common_session_token()) {
2144 + $this->client_error(_("There was a problem with your session token. Try again, please."));
2147 hunk ./actions/favor.php 53
2148 - if ($user->hasFave($notice)) {
2149 - $this->client_error(_('This notice is already a favorite!'));
2152 + if ($user->hasFave($notice)) {
2153 + $this->client_error(_('This notice is already a favorite!'));
2156 hunk ./actions/favor.php 58
2157 - $fave = Fave::addNew($user, $notice);
2158 + $fave = Fave::addNew($user, $notice);
2159 hunk ./actions/favor.php 60
2161 - $this->server_error(_('Could not create favorite.'));
2165 + $this->server_error(_('Could not create favorite.'));
2168 hunk ./actions/favor.php 65
2169 - $this->notify($fave, $notice, $user);
2170 - $user->blowFavesCache();
2172 - if ($this->boolean('ajax')) {
2173 - common_start_html('text/xml;charset=utf-8', true);
2174 - common_element_start('head');
2175 - common_element('title', null, _('Disfavor favorite'));
2176 - common_element_end('head');
2177 - common_element_start('body');
2178 - common_disfavor_form($notice);
2179 - common_element_end('body');
2180 - common_element_end('html');
2182 - common_redirect(common_local_url('showfavorites',
2183 - array('nickname' => $user->nickname)));
2186 + $this->notify($fave, $notice, $user);
2187 + $user->blowFavesCache();
2189 + if ($this->boolean('ajax')) {
2190 + common_start_html('text/xml;charset=utf-8', true);
2191 + common_element_start('head');
2192 + common_element('title', null, _('Disfavor favorite'));
2193 + common_element_end('head');
2194 + common_element_start('body');
2195 + common_disfavor_form($notice);
2196 + common_element_end('body');
2197 + common_element_end('html');
2199 + common_redirect(common_local_url('showfavorites',
2200 + array('nickname' => $user->nickname)));
2203 hunk ./actions/favor.php 83
2204 - function notify($fave, $notice, $user) {
2205 - $other = User::staticGet('id', $notice->profile_id);
2206 - if ($other && $other->id != $user->id) {
2207 - if ($other->email && $other->emailnotifyfav) {
2208 - mail_notify_fave($other, $user, $notice);
2210 - # XXX: notify by IM
2211 - # XXX: notify by SMS
2214 + function notify($fave, $notice, $user) {
2215 + $other = User::staticGet('id', $notice->profile_id);
2216 + if ($other && $other->id != $user->id) {
2217 + if ($other->email && $other->emailnotifyfav) {
2218 + mail_notify_fave($other, $user, $notice);
2220 + # XXX: notify by IM
2221 + # XXX: notify by SMS
2224 hunk ./actions/favorited.php 13
2225 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2226 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2227 hunk ./actions/favorited.php 17
2228 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
2229 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
2230 hunk ./actions/favorited.php 26
2231 - function handle($args) {
2232 - parent::handle($args);
2233 + function handle($args) {
2234 + parent::handle($args);
2235 hunk ./actions/favorited.php 29
2236 - $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
2237 + $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
2238 hunk ./actions/favorited.php 31
2239 - common_show_header(_('Popular notices'),
2240 - array($this, 'show_header'), NULL,
2241 - array($this, 'show_top'));
2242 + common_show_header(_('Popular notices'),
2243 + array($this, 'show_header'), NULL,
2244 + array($this, 'show_top'));
2245 hunk ./actions/favorited.php 35
2246 - $this->show_notices($page);
2247 + $this->show_notices($page);
2248 hunk ./actions/favorited.php 37
2249 - common_show_footer();
2251 + common_show_footer();
2253 hunk ./actions/favorited.php 40
2254 - function show_top() {
2255 - $instr = $this->get_instructions();
2256 - $output = common_markup_to_html($instr);
2257 - common_element_start('div', 'instructions');
2258 - common_raw($output);
2259 - common_element_end('div');
2260 - $this->public_views_menu();
2262 + function show_top() {
2263 + $instr = $this->get_instructions();
2264 + $output = common_markup_to_html($instr);
2265 + common_element_start('div', 'instructions');
2266 + common_raw($output);
2267 + common_element_end('div');
2268 + $this->public_views_menu();
2270 hunk ./actions/favorited.php 49
2271 - function show_header() {
2272 + function show_header() {
2273 hunk ./actions/favorited.php 51
2276 hunk ./actions/favorited.php 53
2277 - function get_instructions() {
2278 - return _('Showing recently popular notices');
2280 + function get_instructions() {
2281 + return _('Showing recently popular notices');
2283 hunk ./actions/favorited.php 57
2284 - function show_notices($page) {
2285 + function show_notices($page) {
2286 hunk ./actions/favorited.php 59
2287 - $qry = 'SELECT notice.*, sum(exp(-(now() - fave.modified) / %s)) as weight ' .
2288 - 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
2289 - 'GROUP BY fave.notice_id ' .
2290 - 'ORDER BY weight DESC';
2291 + $qry = 'SELECT notice.*, sum(exp(-(now() - fave.modified) / %s)) as weight ' .
2292 + 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
2293 + 'GROUP BY fave.notice_id ' .
2294 + 'ORDER BY weight DESC';
2295 hunk ./actions/favorited.php 64
2296 - $offset = ($page - 1) * NOTICES_PER_PAGE;
2297 - $limit = NOTICES_PER_PAGE + 1;
2298 + $offset = ($page - 1) * NOTICES_PER_PAGE;
2299 + $limit = NOTICES_PER_PAGE + 1;
2300 hunk ./actions/favorited.php 67
2301 - if (common_config('db','type') == 'pgsql') {
2302 - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
2304 - $qry .= ' LIMIT ' . $offset . ', ' . $limit;
2306 + if (common_config('db','type') == 'pgsql') {
2307 + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
2309 + $qry .= ' LIMIT ' . $offset . ', ' . $limit;
2311 hunk ./actions/favorited.php 73
2312 - # Figure out how to cache this query
2313 + # Figure out how to cache this query
2314 hunk ./actions/favorited.php 75
2315 - $notice = new Notice;
2316 - $notice->query(sprintf($qry, common_config('popular', 'dropoff')));
2317 + $notice = new Notice;
2318 + $notice->query(sprintf($qry, common_config('popular', 'dropoff')));
2319 hunk ./actions/favorited.php 78
2320 - common_element_start('ul', array('id' => 'notices'));
2321 + common_element_start('ul', array('id' => 'notices'));
2322 hunk ./actions/favorited.php 80
2325 hunk ./actions/favorited.php 82
2326 - while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
2328 + while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
2330 hunk ./actions/favorited.php 85
2331 - if ($cnt > NOTICES_PER_PAGE) {
2334 + if ($cnt > NOTICES_PER_PAGE) {
2337 hunk ./actions/favorited.php 91
2340 hunk ./actions/favorited.php 93
2341 - common_element_end('ul');
2342 + common_element_end('ul');
2343 hunk ./actions/favorited.php 95
2344 - common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
2345 - $page, 'favorited');
2347 + common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
2348 + $page, 'favorited');
2350 hunk ./actions/favoritesrss.php 28
2354 - $nickname = $this->trimmed('nickname');
2355 - $this->user = User::staticGet('nickname', $nickname);
2359 + $nickname = $this->trimmed('nickname');
2360 + $this->user = User::staticGet('nickname', $nickname);
2361 hunk ./actions/favoritesrss.php 34
2362 - if (!$this->user) {
2363 - common_user_error(_('No such user.'));
2369 + if (!$this->user) {
2370 + common_user_error(_('No such user.'));
2376 hunk ./actions/favoritesrss.php 42
2377 - function get_notices($limit=0) {
2378 + function get_notices($limit=0) {
2379 hunk ./actions/favoritesrss.php 44
2380 - $user = $this->user;
2381 + $user = $this->user;
2382 hunk ./actions/favoritesrss.php 46
2383 - $notice = $user->favoriteNotices(0, $limit);
2384 + $notice = $user->favoriteNotices(0, $limit);
2385 hunk ./actions/favoritesrss.php 48
2386 - $notices = array();
2387 + $notices = array();
2388 hunk ./actions/favoritesrss.php 50
2389 - while ($notice->fetch()) {
2390 - $notices[] = clone($notice);
2392 + while ($notice->fetch()) {
2393 + $notices[] = clone($notice);
2395 hunk ./actions/favoritesrss.php 54
2400 hunk ./actions/favoritesrss.php 57
2401 - function get_channel() {
2402 - $user = $this->user;
2403 - $c = array('url' => common_local_url('favoritesrss',
2404 - array('nickname' =>
2405 - $user->nickname)),
2406 - 'title' => sprintf(_("%s favorite notices"), $user->nickname),
2407 - 'link' => common_local_url('showfavorites',
2408 - array('nickname' =>
2409 - $user->nickname)),
2410 - 'description' => sprintf(_('Feed of favorite notices of %s'), $user->nickname));
2413 + function get_channel() {
2414 + $user = $this->user;
2415 + $c = array('url' => common_local_url('favoritesrss',
2416 + array('nickname' =>
2417 + $user->nickname)),
2418 + 'title' => sprintf(_("%s favorite notices"), $user->nickname),
2419 + 'link' => common_local_url('showfavorites',
2420 + array('nickname' =>
2421 + $user->nickname)),
2422 + 'description' => sprintf(_('Feed of favorite notices of %s'), $user->nickname));
2425 hunk ./actions/favoritesrss.php 70
2426 - function get_image() {
2429 + function get_image() {
2432 hunk ./actions/featured.php 13
2433 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2434 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2435 hunk ./actions/featured.php 17
2436 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
2437 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
2438 hunk ./actions/featured.php 27
2439 - function handle($args) {
2440 - parent::handle($args);
2441 + function handle($args) {
2442 + parent::handle($args);
2443 hunk ./actions/featured.php 30
2444 - $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
2445 + $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
2446 hunk ./actions/featured.php 32
2447 - common_show_header(_('Featured users'),
2448 - array($this, 'show_header'), NULL,
2449 - array($this, 'show_top'));
2450 + common_show_header(_('Featured users'),
2451 + array($this, 'show_header'), NULL,
2452 + array($this, 'show_top'));
2453 hunk ./actions/featured.php 36
2454 - $this->show_notices($page);
2455 + $this->show_notices($page);
2456 hunk ./actions/featured.php 38
2457 - common_show_footer();
2459 + common_show_footer();
2461 hunk ./actions/featured.php 41
2462 - function show_top() {
2463 - $instr = $this->get_instructions();
2464 - $output = common_markup_to_html($instr);
2465 - common_element_start('div', 'instructions');
2466 - common_raw($output);
2467 - common_element_end('div');
2468 - $this->public_views_menu();
2470 + function show_top() {
2471 + $instr = $this->get_instructions();
2472 + $output = common_markup_to_html($instr);
2473 + common_element_start('div', 'instructions');
2474 + common_raw($output);
2475 + common_element_end('div');
2476 + $this->public_views_menu();
2478 hunk ./actions/featured.php 50
2479 - function show_header() {
2481 + function show_header() {
2483 hunk ./actions/featured.php 53
2484 - function get_instructions() {
2485 - return _('Featured users');
2487 + function get_instructions() {
2488 + return _('Featured users');
2490 hunk ./actions/featured.php 57
2491 - function show_notices($page) {
2492 + function show_notices($page) {
2493 hunk ./actions/featured.php 59
2494 - // XXX: Note I'm doing it this two-stage way because a raw query
2495 - // with a JOIN was *not* working. --Zach
2496 + // XXX: Note I'm doing it this two-stage way because a raw query
2497 + // with a JOIN was *not* working. --Zach
2498 hunk ./actions/featured.php 62
2499 - $featured_nicks = common_config('nickname', 'featured');
2500 + $featured_nicks = common_config('nickname', 'featured');
2501 hunk ./actions/featured.php 64
2502 - if (count($featured_nicks) > 0) {
2503 + if (count($featured_nicks) > 0) {
2504 hunk ./actions/featured.php 66
2505 - $quoted = array();
2506 + $quoted = array();
2507 hunk ./actions/featured.php 68
2508 - foreach ($featured_nicks as $nick) {
2509 - $quoted[] = "'$nick'";
2511 + foreach ($featured_nicks as $nick) {
2512 + $quoted[] = "'$nick'";
2514 hunk ./actions/featured.php 72
2516 - $user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted)));
2517 - $user->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
2518 - $user->orderBy('user.nickname ASC');
2520 + $user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted)));
2521 + $user->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
2522 + $user->orderBy('user.nickname ASC');
2523 hunk ./actions/featured.php 77
2526 hunk ./actions/featured.php 79
2527 - $profile_ids = array();
2528 + $profile_ids = array();
2529 hunk ./actions/featured.php 81
2530 - while ($user->fetch()) {
2531 - $profile_ids[] = $user->id;
2533 + while ($user->fetch()) {
2534 + $profile_ids[] = $user->id;
2536 hunk ./actions/featured.php 85
2537 - $profile = new Profile;
2538 - $profile->whereAdd(sprintf('profile.id IN (%s)', implode(',', $profile_ids)));
2539 - $profile->orderBy('nickname ASC');
2540 + $profile = new Profile;
2541 + $profile->whereAdd(sprintf('profile.id IN (%s)', implode(',', $profile_ids)));
2542 + $profile->orderBy('nickname ASC');
2543 hunk ./actions/featured.php 89
2544 - $cnt = $profile->find();
2545 + $cnt = $profile->find();
2546 hunk ./actions/featured.php 91
2548 - $featured = new ProfileList($profile);
2549 - $featured->show_list();
2552 + $featured = new ProfileList($profile);
2553 + $featured->show_list();
2555 hunk ./actions/featured.php 96
2558 hunk ./actions/featured.php 98
2559 - common_pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'featured');
2562 + common_pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'featured');
2565 hunk ./actions/finishaddopenid.php 26
2566 - function handle($args) {
2567 - parent::handle($args);
2568 - if (!common_logged_in()) {
2569 - common_user_error(_('Not logged in.'));
2571 - $this->try_login();
2575 - function try_login() {
2576 + function handle($args) {
2577 + parent::handle($args);
2578 + if (!common_logged_in()) {
2579 + common_user_error(_('Not logged in.'));
2581 + $this->try_login();
2585 + function try_login() {
2586 hunk ./actions/finishaddopenid.php 37
2587 - $consumer =& oid_consumer();
2588 + $consumer =& oid_consumer();
2589 hunk ./actions/finishaddopenid.php 39
2590 - $response = $consumer->complete(common_local_url('finishaddopenid'));
2591 + $response = $consumer->complete(common_local_url('finishaddopenid'));
2592 hunk ./actions/finishaddopenid.php 41
2593 - if ($response->status == Auth_OpenID_CANCEL) {
2594 - $this->message(_('OpenID authentication cancelled.'));
2596 - } else if ($response->status == Auth_OpenID_FAILURE) {
2597 - // Authentication failed; display the error message.
2598 - $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
2599 - } else if ($response->status == Auth_OpenID_SUCCESS) {
2600 + if ($response->status == Auth_OpenID_CANCEL) {
2601 + $this->message(_('OpenID authentication cancelled.'));
2603 + } else if ($response->status == Auth_OpenID_FAILURE) {
2604 + // Authentication failed; display the error message.
2605 + $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
2606 + } else if ($response->status == Auth_OpenID_SUCCESS) {
2607 hunk ./actions/finishaddopenid.php 49
2608 - $display = $response->getDisplayIdentifier();
2609 - $canonical = ($response->endpoint && $response->endpoint->canonicalID) ?
2610 - $response->endpoint->canonicalID : $display;
2611 + $display = $response->getDisplayIdentifier();
2612 + $canonical = ($response->endpoint && $response->endpoint->canonicalID) ?
2613 + $response->endpoint->canonicalID : $display;
2614 hunk ./actions/finishaddopenid.php 53
2615 - $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
2616 + $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
2617 hunk ./actions/finishaddopenid.php 55
2619 - $sreg = $sreg_resp->contents();
2622 + $sreg = $sreg_resp->contents();
2624 hunk ./actions/finishaddopenid.php 59
2625 - $cur =& common_current_user();
2626 - $other = oid_get_user($canonical);
2627 + $cur =& common_current_user();
2628 + $other = oid_get_user($canonical);
2629 hunk ./actions/finishaddopenid.php 62
2631 - if ($other->id == $cur->id) {
2632 - $this->message(_('You already have this OpenID!'));
2634 - $this->message(_('Someone else already has this OpenID.'));
2639 + if ($other->id == $cur->id) {
2640 + $this->message(_('You already have this OpenID!'));
2642 + $this->message(_('Someone else already has this OpenID.'));
2646 hunk ./actions/finishaddopenid.php 71
2647 - # start a transaction
2648 + # start a transaction
2649 hunk ./actions/finishaddopenid.php 73
2650 - $cur->query('BEGIN');
2651 + $cur->query('BEGIN');
2652 hunk ./actions/finishaddopenid.php 75
2653 - $result = oid_link_user($cur->id, $canonical, $display);
2654 + $result = oid_link_user($cur->id, $canonical, $display);
2655 hunk ./actions/finishaddopenid.php 77
2657 - $this->message(_('Error connecting user.'));
2661 - if (!oid_update_user($cur, $sreg)) {
2662 - $this->message(_('Error updating profile'));
2667 + $this->message(_('Error connecting user.'));
2671 + if (!oid_update_user($cur, $sreg)) {
2672 + $this->message(_('Error updating profile'));
2676 hunk ./actions/finishaddopenid.php 88
2679 hunk ./actions/finishaddopenid.php 90
2680 - $cur->query('COMMIT');
2681 + $cur->query('COMMIT');
2682 hunk ./actions/finishaddopenid.php 92
2683 - oid_set_last($display);
2684 + oid_set_last($display);
2685 hunk ./actions/finishaddopenid.php 94
2686 - common_redirect(common_local_url('openidsettings'));
2689 + common_redirect(common_local_url('openidsettings'));
2692 hunk ./actions/finishaddopenid.php 98
2693 - function message($msg) {
2694 - common_show_header(_('OpenID Login'));
2695 - common_element('p', NULL, $msg);
2696 - common_show_footer();
2698 + function message($msg) {
2699 + common_show_header(_('OpenID Login'));
2700 + common_element('p', NULL, $msg);
2701 + common_show_footer();
2703 hunk ./actions/finishimmediate.php 26
2704 - function handle($args) {
2705 - parent::handle($args);
2706 + function handle($args) {
2707 + parent::handle($args);
2708 hunk ./actions/finishimmediate.php 29
2709 - $consumer = oid_consumer();
2710 + $consumer = oid_consumer();
2711 hunk ./actions/finishimmediate.php 31
2712 - $response = $consumer->complete(common_local_url('finishimmediate'));
2713 + $response = $consumer->complete(common_local_url('finishimmediate'));
2714 hunk ./actions/finishimmediate.php 33
2715 - if ($response->status == Auth_OpenID_SUCCESS) {
2716 - $display = $response->getDisplayIdentifier();
2717 - $canonical = ($response->endpoint->canonicalID) ?
2718 - $response->endpoint->canonicalID : $response->getDisplayIdentifier();
2719 + if ($response->status == Auth_OpenID_SUCCESS) {
2720 + $display = $response->getDisplayIdentifier();
2721 + $canonical = ($response->endpoint->canonicalID) ?
2722 + $response->endpoint->canonicalID : $response->getDisplayIdentifier();
2723 hunk ./actions/finishimmediate.php 38
2724 - $user = oid_get_user($canonical);
2725 + $user = oid_get_user($canonical);
2726 hunk ./actions/finishimmediate.php 40
2728 - oid_update_user($user, $sreg);
2729 - oid_set_last($display); # refresh for another year
2730 - common_set_user($user->nickname);
2731 - $this->go_backto();
2736 + oid_update_user($user, $sreg);
2737 + oid_set_last($display); # refresh for another year
2738 + common_set_user($user->nickname);
2739 + $this->go_backto();
2743 hunk ./actions/finishimmediate.php 49
2744 - # Failure! Clear openid so we don't try it again
2745 + # Failure! Clear openid so we don't try it again
2746 hunk ./actions/finishimmediate.php 51
2748 - $this->go_backto();
2752 + $this->go_backto();
2755 hunk ./actions/finishimmediate.php 56
2756 - function go_backto() {
2757 - common_ensure_session();
2758 - $backto = $_SESSION['openid_immediate_backto'];
2760 - # gar. Well, push them to the public page
2761 - $backto = common_local_url('public');
2763 - common_redirect($backto);
2765 + function go_backto() {
2766 + common_ensure_session();
2767 + $backto = $_SESSION['openid_immediate_backto'];
2769 + # gar. Well, push them to the public page
2770 + $backto = common_local_url('public');
2772 + common_redirect($backto);
2774 hunk ./actions/finishopenidlogin.php 26
2775 - function handle($args) {
2776 - parent::handle($args);
2777 - if (common_logged_in()) {
2778 - common_user_error(_('Already logged in.'));
2779 - } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
2780 - $token = $this->trimmed('token');
2781 - if (!$token || $token != common_session_token()) {
2782 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
2785 - if ($this->arg('create')) {
2786 - if (!$this->boolean('license')) {
2787 - $this->show_form(_('You can\'t register if you don\'t agree to the license.'),
2788 - $this->trimmed('newname'));
2791 - $this->create_new_user();
2792 - } else if ($this->arg('connect')) {
2793 - $this->connect_user();
2795 - common_debug(print_r($this->args, true), __FILE__);
2796 - $this->show_form(_('Something weird happened.'),
2797 - $this->trimmed('newname'));
2800 - $this->try_login();
2803 + function handle($args) {
2804 + parent::handle($args);
2805 + if (common_logged_in()) {
2806 + common_user_error(_('Already logged in.'));
2807 + } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
2808 + $token = $this->trimmed('token');
2809 + if (!$token || $token != common_session_token()) {
2810 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
2813 + if ($this->arg('create')) {
2814 + if (!$this->boolean('license')) {
2815 + $this->show_form(_('You can\'t register if you don\'t agree to the license.'),
2816 + $this->trimmed('newname'));
2819 + $this->create_new_user();
2820 + } else if ($this->arg('connect')) {
2821 + $this->connect_user();
2823 + common_debug(print_r($this->args, true), __FILE__);
2824 + $this->show_form(_('Something weird happened.'),
2825 + $this->trimmed('newname'));
2828 + $this->try_login();
2831 hunk ./actions/finishopenidlogin.php 55
2832 - function show_top($error=NULL) {
2834 - common_element('div', array('class' => 'error'), $error);
2837 - common_element('div', 'instructions',
2838 - sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), $config['site']['name']));
2841 + function show_top($error=NULL) {
2843 + common_element('div', array('class' => 'error'), $error);
2846 + common_element('div', 'instructions',
2847 + sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), $config['site']['name']));
2850 hunk ./actions/finishopenidlogin.php 65
2851 - function show_form($error=NULL, $username=NULL) {
2852 - common_show_header(_('OpenID Account Setup'), NULL, $error,
2853 - array($this, 'show_top'));
2854 + function show_form($error=NULL, $username=NULL) {
2855 + common_show_header(_('OpenID Account Setup'), NULL, $error,
2856 + array($this, 'show_top'));
2857 hunk ./actions/finishopenidlogin.php 69
2858 - common_element_start('form', array('method' => 'post',
2859 - 'id' => 'account_connect',
2860 - 'action' => common_local_url('finishopenidlogin')));
2861 - common_hidden('token', common_session_token());
2862 - common_element('h2', NULL,
2863 - _('Create new account'));
2864 - common_element('p', NULL,
2865 - _('Create a new user with this nickname.'));
2866 - common_input('newname', _('New nickname'),
2867 - ($username) ? $username : '',
2868 - _('1-64 lowercase letters or numbers, no punctuation or spaces'));
2869 - common_element_start('p');
2870 - common_element('input', array('type' => 'checkbox',
2871 - 'id' => 'license',
2872 - 'name' => 'license',
2873 - 'value' => 'true'));
2874 - common_text(_('My text and files are available under '));
2875 - common_element('a', array(href => common_config('license', 'url')),
2876 - common_config('license', 'title'));
2877 - common_text(_(' except this private data: password, email address, IM address, phone number.'));
2878 - common_element_end('p');
2879 - common_submit('create', _('Create'));
2880 - common_element('h2', NULL,
2881 - _('Connect existing account'));
2882 - common_element('p', NULL,
2883 - _('If you already have an account, login with your username and password to connect it to your OpenID.'));
2884 - common_input('nickname', _('Existing nickname'));
2885 - common_password('password', _('Password'));
2886 - common_submit('connect', _('Connect'));
2887 - common_element_end('form');
2888 - common_show_footer();
2890 + common_element_start('form', array('method' => 'post',
2891 + 'id' => 'account_connect',
2892 + 'action' => common_local_url('finishopenidlogin')));
2893 + common_hidden('token', common_session_token());
2894 + common_element('h2', NULL,
2895 + _('Create new account'));
2896 + common_element('p', NULL,
2897 + _('Create a new user with this nickname.'));
2898 + common_input('newname', _('New nickname'),
2899 + ($username) ? $username : '',
2900 + _('1-64 lowercase letters or numbers, no punctuation or spaces'));
2901 + common_element_start('p');
2902 + common_element('input', array('type' => 'checkbox',
2903 + 'id' => 'license',
2904 + 'name' => 'license',
2905 + 'value' => 'true'));
2906 + common_text(_('My text and files are available under '));
2907 + common_element('a', array(href => common_config('license', 'url')),
2908 + common_config('license', 'title'));
2909 + common_text(_(' except this private data: password, email address, IM address, phone number.'));
2910 + common_element_end('p');
2911 + common_submit('create', _('Create'));
2912 + common_element('h2', NULL,
2913 + _('Connect existing account'));
2914 + common_element('p', NULL,
2915 + _('If you already have an account, login with your username and password to connect it to your OpenID.'));
2916 + common_input('nickname', _('Existing nickname'));
2917 + common_password('password', _('Password'));
2918 + common_submit('connect', _('Connect'));
2919 + common_element_end('form');
2920 + common_show_footer();
2922 hunk ./actions/finishopenidlogin.php 102
2923 - function try_login() {
2924 + function try_login() {
2925 hunk ./actions/finishopenidlogin.php 104
2926 - $consumer = oid_consumer();
2927 + $consumer = oid_consumer();
2928 hunk ./actions/finishopenidlogin.php 106
2929 - $response = $consumer->complete(common_local_url('finishopenidlogin'));
2930 + $response = $consumer->complete(common_local_url('finishopenidlogin'));
2931 hunk ./actions/finishopenidlogin.php 108
2932 - if ($response->status == Auth_OpenID_CANCEL) {
2933 - $this->message(_('OpenID authentication cancelled.'));
2935 - } else if ($response->status == Auth_OpenID_FAILURE) {
2936 - // Authentication failed; display the error message.
2937 - $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
2938 - } else if ($response->status == Auth_OpenID_SUCCESS) {
2939 - // This means the authentication succeeded; extract the
2940 - // identity URL and Simple Registration data (if it was
2942 - $display = $response->getDisplayIdentifier();
2943 - $canonical = ($response->endpoint->canonicalID) ?
2944 - $response->endpoint->canonicalID : $response->getDisplayIdentifier();
2945 + if ($response->status == Auth_OpenID_CANCEL) {
2946 + $this->message(_('OpenID authentication cancelled.'));
2948 + } else if ($response->status == Auth_OpenID_FAILURE) {
2949 + // Authentication failed; display the error message.
2950 + $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
2951 + } else if ($response->status == Auth_OpenID_SUCCESS) {
2952 + // This means the authentication succeeded; extract the
2953 + // identity URL and Simple Registration data (if it was
2955 + $display = $response->getDisplayIdentifier();
2956 + $canonical = ($response->endpoint->canonicalID) ?
2957 + $response->endpoint->canonicalID : $response->getDisplayIdentifier();
2958 hunk ./actions/finishopenidlogin.php 122
2959 - $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
2960 + $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
2961 hunk ./actions/finishopenidlogin.php 124
2963 - $sreg = $sreg_resp->contents();
2966 + $sreg = $sreg_resp->contents();
2968 hunk ./actions/finishopenidlogin.php 128
2969 - $user = oid_get_user($canonical);
2970 + $user = oid_get_user($canonical);
2971 hunk ./actions/finishopenidlogin.php 130
2973 - oid_set_last($display);
2974 - # XXX: commented out at @edd's request until better
2975 - # control over how data flows from OpenID provider.
2976 - # oid_update_user($user, $sreg);
2977 - common_set_user($user);
2978 - common_real_login(true);
2979 - if (isset($_SESSION['openid_rememberme']) && $_SESSION['openid_rememberme']) {
2980 - common_rememberme($user);
2983 + oid_set_last($display);
2984 + # XXX: commented out at @edd's request until better
2985 + # control over how data flows from OpenID provider.
2986 + # oid_update_user($user, $sreg);
2987 + common_set_user($user);
2988 + common_real_login(true);
2989 + if (isset($_SESSION['openid_rememberme']) && $_SESSION['openid_rememberme']) {
2990 + common_rememberme($user);
2992 hunk ./actions/finishopenidlogin.php 141
2993 - $this->go_home($user->nickname);
2995 - $this->save_values($display, $canonical, $sreg);
2996 - $this->show_form(NULL, $this->best_new_nickname($display, $sreg));
3000 + $this->go_home($user->nickname);
3002 + $this->save_values($display, $canonical, $sreg);
3003 + $this->show_form(NULL, $this->best_new_nickname($display, $sreg));
3007 hunk ./actions/finishopenidlogin.php 149
3008 - function message($msg) {
3009 - common_show_header(_('OpenID Login'));
3010 - common_element('p', NULL, $msg);
3011 - common_show_footer();
3013 + function message($msg) {
3014 + common_show_header(_('OpenID Login'));
3015 + common_element('p', NULL, $msg);
3016 + common_show_footer();
3018 hunk ./actions/finishopenidlogin.php 155
3019 - function save_values($display, $canonical, $sreg) {
3020 - common_ensure_session();
3021 - $_SESSION['openid_display'] = $display;
3022 - $_SESSION['openid_canonical'] = $canonical;
3023 - $_SESSION['openid_sreg'] = $sreg;
3025 + function save_values($display, $canonical, $sreg) {
3026 + common_ensure_session();
3027 + $_SESSION['openid_display'] = $display;
3028 + $_SESSION['openid_canonical'] = $canonical;
3029 + $_SESSION['openid_sreg'] = $sreg;
3031 hunk ./actions/finishopenidlogin.php 162
3032 - function get_saved_values() {
3033 - return array($_SESSION['openid_display'],
3034 - $_SESSION['openid_canonical'],
3035 - $_SESSION['openid_sreg']);
3037 + function get_saved_values() {
3038 + return array($_SESSION['openid_display'],
3039 + $_SESSION['openid_canonical'],
3040 + $_SESSION['openid_sreg']);
3042 hunk ./actions/finishopenidlogin.php 168
3043 - function create_new_user() {
3044 + function create_new_user() {
3045 hunk ./actions/finishopenidlogin.php 172
3046 - if (common_config('site', 'closed') || common_config('site', 'inviteonly')) {
3047 - common_user_error(_('Registration not allowed.'));
3048 + if (common_config('site', 'closed') || common_config('site', 'inviteonly')) {
3049 + common_user_error(_('Registration not allowed.'));
3050 hunk ./actions/finishopenidlogin.php 177
3051 - $nickname = $this->trimmed('newname');
3052 + $nickname = $this->trimmed('newname');
3053 hunk ./actions/finishopenidlogin.php 179
3054 - if (!Validate::string($nickname, array('min_length' => 1,
3055 - 'max_length' => 64,
3056 - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
3057 - $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
3060 + if (!Validate::string($nickname, array('min_length' => 1,
3061 + 'max_length' => 64,
3062 + 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
3063 + $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
3066 hunk ./actions/finishopenidlogin.php 186
3067 - if (!User::allowed_nickname($nickname)) {
3068 - $this->show_form(_('Nickname not allowed.'));
3071 + if (!User::allowed_nickname($nickname)) {
3072 + $this->show_form(_('Nickname not allowed.'));
3075 hunk ./actions/finishopenidlogin.php 191
3076 - if (User::staticGet('nickname', $nickname)) {
3077 - $this->show_form(_('Nickname already in use. Try another one.'));
3080 + if (User::staticGet('nickname', $nickname)) {
3081 + $this->show_form(_('Nickname already in use. Try another one.'));
3084 hunk ./actions/finishopenidlogin.php 196
3085 - list($display, $canonical, $sreg) = $this->get_saved_values();
3086 + list($display, $canonical, $sreg) = $this->get_saved_values();
3087 hunk ./actions/finishopenidlogin.php 198
3088 - if (!$display || !$canonical) {
3089 - common_server_error(_('Stored OpenID not found.'));
3092 + if (!$display || !$canonical) {
3093 + common_server_error(_('Stored OpenID not found.'));
3096 hunk ./actions/finishopenidlogin.php 203
3097 - # Possible race condition... let's be paranoid
3098 + # Possible race condition... let's be paranoid
3099 hunk ./actions/finishopenidlogin.php 205
3100 - $other = oid_get_user($canonical);
3101 + $other = oid_get_user($canonical);
3102 hunk ./actions/finishopenidlogin.php 207
3104 - common_server_error(_('Creating new account for OpenID that already has a user.'));
3108 + common_server_error(_('Creating new account for OpenID that already has a user.'));
3111 hunk ./actions/finishopenidlogin.php 212
3112 - if ($sreg['country']) {
3113 - if ($sreg['postcode']) {
3114 - # XXX: use postcode to get city and region
3115 - # XXX: also, store postcode somewhere -- it's valuable!
3116 - $location = $sreg['postcode'] . ', ' . $sreg['country'];
3118 - $location = $sreg['country'];
3121 + if ($sreg['country']) {
3122 + if ($sreg['postcode']) {
3123 + # XXX: use postcode to get city and region
3124 + # XXX: also, store postcode somewhere -- it's valuable!
3125 + $location = $sreg['postcode'] . ', ' . $sreg['country'];
3127 + $location = $sreg['country'];
3130 hunk ./actions/finishopenidlogin.php 222
3131 - if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
3132 - $fullname = $sreg['fullname'];
3134 + if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
3135 + $fullname = $sreg['fullname'];
3137 hunk ./actions/finishopenidlogin.php 226
3138 - if ($sreg['email'] && Validate::email($sreg['email'], true)) {
3139 - $email = $sreg['email'];
3141 + if ($sreg['email'] && Validate::email($sreg['email'], true)) {
3142 + $email = $sreg['email'];
3144 hunk ./actions/finishopenidlogin.php 230
3145 - # XXX: add language
3146 - # XXX: add timezone
3147 + # XXX: add language
3148 + # XXX: add timezone
3149 hunk ./actions/finishopenidlogin.php 233
3150 - $user = User::register(array('nickname' => $nickname,
3151 - 'email' => $email,
3152 - 'fullname' => $fullname,
3153 - 'location' => $location));
3154 + $user = User::register(array('nickname' => $nickname,
3155 + 'email' => $email,
3156 + 'fullname' => $fullname,
3157 + 'location' => $location));
3158 hunk ./actions/finishopenidlogin.php 238
3159 - $result = oid_link_user($user->id, $canonical, $display);
3160 + $result = oid_link_user($user->id, $canonical, $display);
3161 hunk ./actions/finishopenidlogin.php 240
3162 - oid_set_last($display);
3163 - common_set_user($user);
3164 - common_real_login(true);
3165 + oid_set_last($display);
3166 + common_set_user($user);
3167 + common_real_login(true);
3168 hunk ./actions/finishopenidlogin.php 244
3169 - common_rememberme($user);
3171 + common_rememberme($user);
3173 hunk ./actions/finishopenidlogin.php 247
3174 - common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)));
3176 + common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)));
3178 hunk ./actions/finishopenidlogin.php 250
3179 - function connect_user() {
3180 + function connect_user() {
3181 hunk ./actions/finishopenidlogin.php 252
3182 - $nickname = $this->trimmed('nickname');
3183 - $password = $this->trimmed('password');
3184 + $nickname = $this->trimmed('nickname');
3185 + $password = $this->trimmed('password');
3186 hunk ./actions/finishopenidlogin.php 255
3187 - if (!common_check_user($nickname, $password)) {
3188 - $this->show_form(_('Invalid username or password.'));
3191 + if (!common_check_user($nickname, $password)) {
3192 + $this->show_form(_('Invalid username or password.'));
3195 hunk ./actions/finishopenidlogin.php 260
3198 hunk ./actions/finishopenidlogin.php 262
3199 - $user = User::staticGet('nickname', $nickname);
3200 + $user = User::staticGet('nickname', $nickname);
3201 hunk ./actions/finishopenidlogin.php 264
3202 - list($display, $canonical, $sreg) = $this->get_saved_values();
3203 + list($display, $canonical, $sreg) = $this->get_saved_values();
3204 hunk ./actions/finishopenidlogin.php 266
3205 - if (!$display || !$canonical) {
3206 - common_server_error(_('Stored OpenID not found.'));
3209 + if (!$display || !$canonical) {
3210 + common_server_error(_('Stored OpenID not found.'));
3213 hunk ./actions/finishopenidlogin.php 271
3214 - $result = oid_link_user($user->id, $canonical, $display);
3215 + $result = oid_link_user($user->id, $canonical, $display);
3216 hunk ./actions/finishopenidlogin.php 273
3218 - common_server_error(_('Error connecting user to OpenID.'));
3222 + common_server_error(_('Error connecting user to OpenID.'));
3225 hunk ./actions/finishopenidlogin.php 278
3226 - oid_update_user($user, $sreg);
3227 - oid_set_last($display);
3228 - common_set_user($user);
3229 - common_real_login(true);
3230 + oid_update_user($user, $sreg);
3231 + oid_set_last($display);
3232 + common_set_user($user);
3233 + common_real_login(true);
3234 hunk ./actions/finishopenidlogin.php 283
3235 - common_rememberme($user);
3237 - unset($_SESSION['openid_rememberme']);
3238 - $this->go_home($user->nickname);
3240 + common_rememberme($user);
3242 + unset($_SESSION['openid_rememberme']);
3243 + $this->go_home($user->nickname);
3245 hunk ./actions/finishopenidlogin.php 289
3246 - function go_home($nickname) {
3247 - $url = common_get_returnto();
3249 - # We don't have to return to it again
3250 - common_set_returnto(NULL);
3252 - $url = common_local_url('all',
3253 - array('nickname' =>
3256 - common_redirect($url);
3258 + function go_home($nickname) {
3259 + $url = common_get_returnto();
3261 + # We don't have to return to it again
3262 + common_set_returnto(NULL);
3264 + $url = common_local_url('all',
3265 + array('nickname' =>
3268 + common_redirect($url);
3270 hunk ./actions/finishopenidlogin.php 302
3271 - function best_new_nickname($display, $sreg) {
3272 + function best_new_nickname($display, $sreg) {
3273 hunk ./actions/finishopenidlogin.php 304
3274 - # Try the passed-in nickname
3275 + # Try the passed-in nickname
3276 hunk ./actions/finishopenidlogin.php 306
3277 - if ($sreg['nickname']) {
3278 - $nickname = $this->nicknamize($sreg['nickname']);
3279 - if ($this->is_new_nickname($nickname)) {
3283 + if ($sreg['nickname']) {
3284 + $nickname = $this->nicknamize($sreg['nickname']);
3285 + if ($this->is_new_nickname($nickname)) {
3289 hunk ./actions/finishopenidlogin.php 313
3290 - # Try the full name
3291 + # Try the full name
3292 hunk ./actions/finishopenidlogin.php 315
3293 - if ($sreg['fullname']) {
3294 - $fullname = $this->nicknamize($sreg['fullname']);
3295 - if ($this->is_new_nickname($fullname)) {
3299 + if ($sreg['fullname']) {
3300 + $fullname = $this->nicknamize($sreg['fullname']);
3301 + if ($this->is_new_nickname($fullname)) {
3305 hunk ./actions/finishopenidlogin.php 322
3308 hunk ./actions/finishopenidlogin.php 324
3309 - $from_url = $this->openid_to_nickname($display);
3310 + $from_url = $this->openid_to_nickname($display);
3311 hunk ./actions/finishopenidlogin.php 326
3312 - if ($from_url && $this->is_new_nickname($from_url)) {
3315 + if ($from_url && $this->is_new_nickname($from_url)) {
3318 hunk ./actions/finishopenidlogin.php 330
3321 hunk ./actions/finishopenidlogin.php 332
3326 hunk ./actions/finishopenidlogin.php 335
3327 - function is_new_nickname($str) {
3328 - if (!Validate::string($str, array('min_length' => 1,
3329 - 'max_length' => 64,
3330 - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
3333 - if (!User::allowed_nickname($str)) {
3336 - if (User::staticGet('nickname', $str)) {
3341 + function is_new_nickname($str) {
3342 + if (!Validate::string($str, array('min_length' => 1,
3343 + 'max_length' => 64,
3344 + 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
3347 + if (!User::allowed_nickname($str)) {
3350 + if (User::staticGet('nickname', $str)) {
3355 hunk ./actions/finishopenidlogin.php 350
3356 - function openid_to_nickname($openid) {
3357 + function openid_to_nickname($openid) {
3358 hunk ./actions/finishopenidlogin.php 352
3359 - return $this->xri_to_nickname($openid);
3361 - return $this->url_to_nickname($openid);
3364 + return $this->xri_to_nickname($openid);
3366 + return $this->url_to_nickname($openid);
3369 hunk ./actions/finishopenidlogin.php 358
3370 - # We try to use an OpenID URL as a legal Laconica user name in this order
3371 - # 1. Plain hostname, like http://evanp.myopenid.com/
3372 - # 2. One element in path, like http://profile.typekey.com/EvanProdromou/
3373 - # or http://getopenid.com/evanprodromou
3374 + # We try to use an OpenID URL as a legal Laconica user name in this order
3375 + # 1. Plain hostname, like http://evanp.myopenid.com/
3376 + # 2. One element in path, like http://profile.typekey.com/EvanProdromou/
3377 + # or http://getopenid.com/evanprodromou
3378 hunk ./actions/finishopenidlogin.php 364
3379 - static $bad = array('query', 'user', 'password', 'port', 'fragment');
3380 + static $bad = array('query', 'user', 'password', 'port', 'fragment');
3381 hunk ./actions/finishopenidlogin.php 366
3382 - $parts = parse_url($openid);
3383 + $parts = parse_url($openid);
3384 hunk ./actions/finishopenidlogin.php 368
3385 - # If any of these parts exist, this won't work
3386 + # If any of these parts exist, this won't work
3387 hunk ./actions/finishopenidlogin.php 370
3388 - foreach ($bad as $badpart) {
3389 - if (array_key_exists($badpart, $parts)) {
3393 + foreach ($bad as $badpart) {
3394 + if (array_key_exists($badpart, $parts)) {
3398 hunk ./actions/finishopenidlogin.php 376
3399 - # We just have host and/or path
3400 + # We just have host and/or path
3401 hunk ./actions/finishopenidlogin.php 378
3402 - # If it's just a host...
3403 - if (array_key_exists('host', $parts) &&
3404 - (!array_key_exists('path', $parts) || strcmp($parts['path'], '/') == 0))
3406 - $hostparts = explode('.', $parts['host']);
3407 + # If it's just a host...
3408 + if (array_key_exists('host', $parts) &&
3409 + (!array_key_exists('path', $parts) || strcmp($parts['path'], '/') == 0))
3411 + $hostparts = explode('.', $parts['host']);
3412 hunk ./actions/finishopenidlogin.php 384
3413 - # Try to catch common idiom of nickname.service.tld
3414 + # Try to catch common idiom of nickname.service.tld
3415 hunk ./actions/finishopenidlogin.php 386
3416 - if ((count($hostparts) > 2) &&
3417 - (strlen($hostparts[count($hostparts) - 2]) > 3) && # try to skip .co.uk, .com.au
3418 - (strcmp($hostparts[0], 'www') != 0))
3420 - return $this->nicknamize($hostparts[0]);
3422 - # Do the whole hostname
3423 - return $this->nicknamize($parts['host']);
3426 - if (array_key_exists('path', $parts)) {
3427 - # Strip starting, ending slashes
3428 - $path = preg_replace('@/$@', '', $parts['path']);
3429 - $path = preg_replace('@^/@', '', $path);
3430 - if (strpos($path, '/') === false) {
3431 - return $this->nicknamize($path);
3435 + if ((count($hostparts) > 2) &&
3436 + (strlen($hostparts[count($hostparts) - 2]) > 3) && # try to skip .co.uk, .com.au
3437 + (strcmp($hostparts[0], 'www') != 0))
3439 + return $this->nicknamize($hostparts[0]);
3441 + # Do the whole hostname
3442 + return $this->nicknamize($parts['host']);
3445 + if (array_key_exists('path', $parts)) {
3446 + # Strip starting, ending slashes
3447 + $path = preg_replace('@/$@', '', $parts['path']);
3448 + $path = preg_replace('@^/@', '', $path);
3449 + if (strpos($path, '/') === false) {
3450 + return $this->nicknamize($path);
3454 hunk ./actions/finishopenidlogin.php 406
3459 hunk ./actions/finishopenidlogin.php 409
3460 - function xri_to_nickname($xri) {
3461 - $base = $this->xri_base($xri);
3462 + function xri_to_nickname($xri) {
3463 + $base = $this->xri_base($xri);
3464 hunk ./actions/finishopenidlogin.php 412
3469 - # or @gratis*evan.prodromou
3470 - $parts = explode('*', substr($base, 1));
3471 - return $this->nicknamize(array_pop($parts));
3478 + # or @gratis*evan.prodromou
3479 + $parts = explode('*', substr($base, 1));
3480 + return $this->nicknamize(array_pop($parts));
3483 hunk ./actions/finishopenidlogin.php 422
3484 - function xri_base($xri) {
3485 - if (substr($xri, 0, 6) == 'xri://') {
3486 - return substr($xri, 6);
3491 + function xri_base($xri) {
3492 + if (substr($xri, 0, 6) == 'xri://') {
3493 + return substr($xri, 6);
3498 hunk ./actions/finishopenidlogin.php 430
3499 - # Given a string, try to make it work as a nickname
3500 + # Given a string, try to make it work as a nickname
3501 hunk ./actions/finishopenidlogin.php 432
3502 - function nicknamize($str) {
3503 - $str = preg_replace('/\W/', '', $str);
3504 - return strtolower($str);
3506 + function nicknamize($str) {
3507 + $str = preg_replace('/\W/', '', $str);
3508 + return strtolower($str);
3510 hunk ./actions/finishremotesubscribe.php 26
3511 - function handle($args) {
3512 + function handle($args) {
3513 hunk ./actions/finishremotesubscribe.php 28
3514 - parent::handle($args);
3515 + parent::handle($args);
3516 hunk ./actions/finishremotesubscribe.php 30
3517 - if (common_logged_in()) {
3518 - common_user_error(_('You can use the local subscription!'));
3521 + if (common_logged_in()) {
3522 + common_user_error(_('You can use the local subscription!'));
3525 hunk ./actions/finishremotesubscribe.php 35
3526 - $omb = $_SESSION['oauth_authorization_request'];
3527 + $omb = $_SESSION['oauth_authorization_request'];
3528 hunk ./actions/finishremotesubscribe.php 37
3530 - common_user_error(_('Not expecting this response!'));
3534 + common_user_error(_('Not expecting this response!'));
3537 hunk ./actions/finishremotesubscribe.php 42
3538 - common_debug('stored request: '.print_r($omb,true), __FILE__);
3539 + common_debug('stored request: '.print_r($omb,true), __FILE__);
3540 hunk ./actions/finishremotesubscribe.php 44
3541 - common_remove_magic_from_request();
3542 - $req = OAuthRequest::from_request();
3543 + common_remove_magic_from_request();
3544 + $req = OAuthRequest::from_request();
3545 hunk ./actions/finishremotesubscribe.php 47
3546 - $token = $req->get_parameter('oauth_token');
3547 + $token = $req->get_parameter('oauth_token');
3548 hunk ./actions/finishremotesubscribe.php 49
3549 - # I think this is the success metric
3550 + # I think this is the success metric
3551 hunk ./actions/finishremotesubscribe.php 51
3552 - if ($token != $omb['token']) {
3553 - common_user_error(_('Not authorized.'));
3556 + if ($token != $omb['token']) {
3557 + common_user_error(_('Not authorized.'));
3560 hunk ./actions/finishremotesubscribe.php 56
3561 - $version = $req->get_parameter('omb_version');
3562 + $version = $req->get_parameter('omb_version');
3563 hunk ./actions/finishremotesubscribe.php 58
3564 - if ($version != OMB_VERSION_01) {
3565 - common_user_error(_('Unknown version of OMB protocol.'));
3568 + if ($version != OMB_VERSION_01) {
3569 + common_user_error(_('Unknown version of OMB protocol.'));
3572 hunk ./actions/finishremotesubscribe.php 63
3573 - $nickname = $req->get_parameter('omb_listener_nickname');
3574 + $nickname = $req->get_parameter('omb_listener_nickname');
3575 hunk ./actions/finishremotesubscribe.php 65
3577 - common_user_error(_('No nickname provided by remote server.'));
3581 + common_user_error(_('No nickname provided by remote server.'));
3584 hunk ./actions/finishremotesubscribe.php 70
3585 - $profile_url = $req->get_parameter('omb_listener_profile');
3586 + $profile_url = $req->get_parameter('omb_listener_profile');
3587 hunk ./actions/finishremotesubscribe.php 72
3588 - if (!$profile_url) {
3589 - common_user_error(_('No profile URL returned by server.'));
3592 + if (!$profile_url) {
3593 + common_user_error(_('No profile URL returned by server.'));
3596 hunk ./actions/finishremotesubscribe.php 77
3597 - if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) {
3598 - common_user_error(_('Invalid profile URL returned by server.'));
3601 + if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) {
3602 + common_user_error(_('Invalid profile URL returned by server.'));
3605 hunk ./actions/finishremotesubscribe.php 82
3606 - if ($profile_url == common_local_url('showstream', array('nickname' => $nickname))) {
3607 - common_user_error(_('You can use the local subscription!'));
3610 + if ($profile_url == common_local_url('showstream', array('nickname' => $nickname))) {
3611 + common_user_error(_('You can use the local subscription!'));
3614 hunk ./actions/finishremotesubscribe.php 87
3615 - common_debug('listenee: "'.$omb['listenee'].'"', __FILE__);
3616 + common_debug('listenee: "'.$omb['listenee'].'"', __FILE__);
3617 hunk ./actions/finishremotesubscribe.php 89
3618 - $user = User::staticGet('nickname', $omb['listenee']);
3619 + $user = User::staticGet('nickname', $omb['listenee']);
3620 hunk ./actions/finishremotesubscribe.php 91
3622 - common_user_error(_('User being listened to doesn\'t exist.'));
3626 + common_user_error(_('User being listened to doesn\'t exist.'));
3629 hunk ./actions/finishremotesubscribe.php 96
3630 - $other = User::staticGet('uri', $omb['listener']);
3631 + $other = User::staticGet('uri', $omb['listener']);
3632 hunk ./actions/finishremotesubscribe.php 98
3634 - common_user_error(_('You can use the local subscription!'));
3638 + common_user_error(_('You can use the local subscription!'));
3641 hunk ./actions/finishremotesubscribe.php 103
3642 - $fullname = $req->get_parameter('omb_listener_fullname');
3643 - $homepage = $req->get_parameter('omb_listener_homepage');
3644 - $bio = $req->get_parameter('omb_listener_bio');
3645 - $location = $req->get_parameter('omb_listener_location');
3646 - $avatar_url = $req->get_parameter('omb_listener_avatar');
3647 + $fullname = $req->get_parameter('omb_listener_fullname');
3648 + $homepage = $req->get_parameter('omb_listener_homepage');
3649 + $bio = $req->get_parameter('omb_listener_bio');
3650 + $location = $req->get_parameter('omb_listener_location');
3651 + $avatar_url = $req->get_parameter('omb_listener_avatar');
3652 hunk ./actions/finishremotesubscribe.php 109
3653 - list($newtok, $newsecret) = $this->access_token($omb);
3654 + list($newtok, $newsecret) = $this->access_token($omb);
3655 hunk ./actions/finishremotesubscribe.php 111
3656 - if (!$newtok || !$newsecret) {
3657 - common_user_error(_('Couldn\'t convert request tokens to access tokens.'));
3660 + if (!$newtok || !$newsecret) {
3661 + common_user_error(_('Couldn\'t convert request tokens to access tokens.'));
3664 hunk ./actions/finishremotesubscribe.php 116
3665 - # XXX: possible attack point; subscribe and return someone else's profile URI
3666 + # XXX: possible attack point; subscribe and return someone else's profile URI
3667 hunk ./actions/finishremotesubscribe.php 118
3668 - $remote = Remote_profile::staticGet('uri', $omb['listener']);
3669 + $remote = Remote_profile::staticGet('uri', $omb['listener']);
3670 hunk ./actions/finishremotesubscribe.php 120
3673 - $profile = Profile::staticGet($remote->id);
3674 - $orig_remote = clone($remote);
3675 - $orig_profile = clone($profile);
3676 - # XXX: compare current postNotice and updateProfile URLs to the ones
3677 - # stored in the DB to avoid (possibly...) above attack
3680 - $remote = new Remote_profile();
3681 - $remote->uri = $omb['listener'];
3682 - $profile = new Profile();
3686 + $profile = Profile::staticGet($remote->id);
3687 + $orig_remote = clone($remote);
3688 + $orig_profile = clone($profile);
3689 + # XXX: compare current postNotice and updateProfile URLs to the ones
3690 + # stored in the DB to avoid (possibly...) above attack
3693 + $remote = new Remote_profile();
3694 + $remote->uri = $omb['listener'];
3695 + $profile = new Profile();
3697 hunk ./actions/finishremotesubscribe.php 134
3698 - $profile->nickname = $nickname;
3699 - $profile->profileurl = $profile_url;
3700 + $profile->nickname = $nickname;
3701 + $profile->profileurl = $profile_url;
3702 hunk ./actions/finishremotesubscribe.php 137
3704 - $profile->fullname = $fullname;
3707 - $profile->homepage = $homepage;
3710 - $profile->bio = $bio;
3713 - $profile->location = $location;
3716 + $profile->fullname = $fullname;
3719 + $profile->homepage = $homepage;
3722 + $profile->bio = $bio;
3725 + $profile->location = $location;
3727 hunk ./actions/finishremotesubscribe.php 150
3729 - $profile->update($orig_profile);
3731 - $profile->created = DB_DataObject_Cast::dateTime(); # current time
3732 - $id = $profile->insert();
3734 - common_server_error(_('Error inserting new profile'));
3737 - $remote->id = $id;
3740 + $profile->update($orig_profile);
3742 + $profile->created = DB_DataObject_Cast::dateTime(); # current time
3743 + $id = $profile->insert();
3745 + common_server_error(_('Error inserting new profile'));
3748 + $remote->id = $id;
3750 hunk ./actions/finishremotesubscribe.php 162
3751 - if ($avatar_url) {
3752 - if (!$this->add_avatar($profile, $avatar_url)) {
3753 - common_server_error(_('Error inserting avatar'));
3757 + if ($avatar_url) {
3758 + if (!$this->add_avatar($profile, $avatar_url)) {
3759 + common_server_error(_('Error inserting avatar'));
3763 hunk ./actions/finishremotesubscribe.php 169
3764 - $remote->postnoticeurl = $omb['post_notice_url'];
3765 - $remote->updateprofileurl = $omb['update_profile_url'];
3766 + $remote->postnoticeurl = $omb['post_notice_url'];
3767 + $remote->updateprofileurl = $omb['update_profile_url'];
3768 hunk ./actions/finishremotesubscribe.php 172
3770 - if (!$remote->update($orig_remote)) {
3771 - common_server_error(_('Error updating remote profile'));
3775 - $remote->created = DB_DataObject_Cast::dateTime(); # current time
3776 - if (!$remote->insert()) {
3777 - common_server_error(_('Error inserting remote profile'));
3782 + if (!$remote->update($orig_remote)) {
3783 + common_server_error(_('Error updating remote profile'));
3787 + $remote->created = DB_DataObject_Cast::dateTime(); # current time
3788 + if (!$remote->insert()) {
3789 + common_server_error(_('Error inserting remote profile'));
3793 hunk ./actions/finishremotesubscribe.php 190
3794 - $sub = new Subscription();
3795 + $sub = new Subscription();
3796 hunk ./actions/finishremotesubscribe.php 192
3797 - $sub->subscriber = $remote->id;
3798 - $sub->subscribed = $user->id;
3799 + $sub->subscriber = $remote->id;
3800 + $sub->subscribed = $user->id;
3801 hunk ./actions/finishremotesubscribe.php 205
3802 - $sub->token = $newtok;
3803 - $sub->secret = $newsecret;
3804 + $sub->token = $newtok;
3805 + $sub->secret = $newsecret;
3806 hunk ./actions/finishremotesubscribe.php 214
3809 hunk ./actions/finishremotesubscribe.php 216
3810 - common_user_error(_('Couldn\'t insert new subscription.'));
3813 + common_user_error(_('Couldn\'t insert new subscription.'));
3816 hunk ./actions/finishremotesubscribe.php 220
3817 - # Notify user, if necessary
3818 + # Notify user, if necessary
3819 hunk ./actions/finishremotesubscribe.php 222
3820 - mail_subscribe_notify_profile($user, $profile);
3821 + mail_subscribe_notify_profile($user, $profile);
3822 hunk ./actions/finishremotesubscribe.php 224
3824 - unset($_SESSION['oauth_authorization_request']);
3826 + unset($_SESSION['oauth_authorization_request']);
3827 hunk ./actions/finishremotesubscribe.php 227
3828 - # If we show subscriptions in reverse chron order, this should
3829 - # show up close to the top of the page
3830 + # If we show subscriptions in reverse chron order, this should
3831 + # show up close to the top of the page
3832 hunk ./actions/finishremotesubscribe.php 230
3833 - common_redirect(common_local_url('subscribers', array('nickname' =>
3834 - $user->nickname)));
3836 + common_redirect(common_local_url('subscribers', array('nickname' =>
3837 + $user->nickname)));
3839 hunk ./actions/finishremotesubscribe.php 234
3840 - function add_avatar($profile, $url) {
3841 - $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
3842 - copy($url, $temp_filename);
3843 - return $profile->setOriginal($temp_filename);
3845 + function add_avatar($profile, $url) {
3846 + $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
3847 + copy($url, $temp_filename);
3848 + return $profile->setOriginal($temp_filename);
3850 hunk ./actions/finishremotesubscribe.php 240
3851 - function access_token($omb) {
3852 + function access_token($omb) {
3853 hunk ./actions/finishremotesubscribe.php 242
3854 - common_debug('starting request for access token', __FILE__);
3855 + common_debug('starting request for access token', __FILE__);
3856 hunk ./actions/finishremotesubscribe.php 244
3857 - $con = omb_oauth_consumer();
3858 - $tok = new OAuthToken($omb['token'], $omb['secret']);
3859 + $con = omb_oauth_consumer();
3860 + $tok = new OAuthToken($omb['token'], $omb['secret']);
3861 hunk ./actions/finishremotesubscribe.php 247
3862 - common_debug('using request token "'.$tok.'"', __FILE__);
3863 + common_debug('using request token "'.$tok.'"', __FILE__);
3864 hunk ./actions/finishremotesubscribe.php 249
3865 - $url = $omb['access_token_url'];
3866 + $url = $omb['access_token_url'];
3867 hunk ./actions/finishremotesubscribe.php 251
3868 - common_debug('using access token url "'.$url.'"', __FILE__);
3869 + common_debug('using access token url "'.$url.'"', __FILE__);
3870 hunk ./actions/finishremotesubscribe.php 253
3871 - # XXX: Is this the right thing to do? Strip off GET params and make them
3872 - # POST params? Seems wrong to me.
3873 + # XXX: Is this the right thing to do? Strip off GET params and make them
3874 + # POST params? Seems wrong to me.
3875 hunk ./actions/finishremotesubscribe.php 256
3876 - $parsed = parse_url($url);
3877 - $params = array();
3878 - parse_str($parsed['query'], $params);
3879 + $parsed = parse_url($url);
3880 + $params = array();
3881 + parse_str($parsed['query'], $params);
3882 hunk ./actions/finishremotesubscribe.php 260
3883 - $req = OAuthRequest::from_consumer_and_token($con, $tok, "POST", $url, $params);
3884 + $req = OAuthRequest::from_consumer_and_token($con, $tok, "POST", $url, $params);
3885 hunk ./actions/finishremotesubscribe.php 262
3886 - $req->set_parameter('omb_version', OMB_VERSION_01);
3887 + $req->set_parameter('omb_version', OMB_VERSION_01);
3888 hunk ./actions/finishremotesubscribe.php 264
3889 - # XXX: test to see if endpoint accepts this signature method
3890 + # XXX: test to see if endpoint accepts this signature method
3891 hunk ./actions/finishremotesubscribe.php 266
3892 - $req->sign_request(omb_hmac_sha1(), $con, $tok);
3893 + $req->sign_request(omb_hmac_sha1(), $con, $tok);
3894 hunk ./actions/finishremotesubscribe.php 268
3895 - # We re-use this tool's fetcher, since it's pretty good
3896 + # We re-use this tool's fetcher, since it's pretty good
3897 hunk ./actions/finishremotesubscribe.php 270
3898 - common_debug('posting to access token url "'.$req->get_normalized_http_url().'"', __FILE__);
3899 - common_debug('posting request data "'.$req->to_postdata().'"', __FILE__);
3900 + common_debug('posting to access token url "'.$req->get_normalized_http_url().'"', __FILE__);
3901 + common_debug('posting request data "'.$req->to_postdata().'"', __FILE__);
3902 hunk ./actions/finishremotesubscribe.php 273
3903 - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
3904 - $result = $fetcher->post($req->get_normalized_http_url(),
3905 - $req->to_postdata(),
3906 + $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
3907 + $result = $fetcher->post($req->get_normalized_http_url(),
3908 + $req->to_postdata(),
3909 hunk ./actions/finishremotesubscribe.php 278
3910 - common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__);
3911 + common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__);
3912 hunk ./actions/finishremotesubscribe.php 280
3913 - if ($result->status != 200) {
3916 + if ($result->status != 200) {
3919 hunk ./actions/finishremotesubscribe.php 284
3920 - parse_str($result->body, $return);
3921 + parse_str($result->body, $return);
3922 hunk ./actions/finishremotesubscribe.php 286
3923 - return array($return['oauth_token'], $return['oauth_token_secret']);
3925 + return array($return['oauth_token'], $return['oauth_token_secret']);
3927 hunk ./actions/foaf.php 28
3928 - function is_readonly() {
3931 + function is_readonly() {
3934 hunk ./actions/foaf.php 32
3935 - function handle($args) {
3936 - parent::handle($args);
3937 + function handle($args) {
3938 + parent::handle($args);
3939 hunk ./actions/foaf.php 35
3940 - $nickname = $this->trimmed('nickname');
3941 + $nickname = $this->trimmed('nickname');
3942 hunk ./actions/foaf.php 37
3943 - $user = User::staticGet('nickname', $nickname);
3944 + $user = User::staticGet('nickname', $nickname);
3945 hunk ./actions/foaf.php 39
3947 - common_user_error(_('No such user.'), 404);
3951 + common_user_error(_('No such user.'), 404);
3954 hunk ./actions/foaf.php 44
3955 - $profile = $user->getProfile();
3956 + $profile = $user->getProfile();
3957 hunk ./actions/foaf.php 46
3959 - common_server_error(_('User has no profile.'), 500);
3963 + common_server_error(_('User has no profile.'), 500);
3966 hunk ./actions/foaf.php 51
3967 - header('Content-Type: application/rdf+xml');
3968 + header('Content-Type: application/rdf+xml');
3969 hunk ./actions/foaf.php 53
3970 - common_start_xml();
3971 - common_element_start('rdf:RDF', array('xmlns:rdf' =>
3972 - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
3974 - 'http://www.w3.org/2000/01/rdf-schema#',
3976 - 'http://www.w3.org/2003/01/geo/wgs84_pos#',
3977 - 'xmlns' => 'http://xmlns.com/foaf/0.1/'));
3978 + common_start_xml();
3979 + common_element_start('rdf:RDF', array('xmlns:rdf' =>
3980 + 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
3982 + 'http://www.w3.org/2000/01/rdf-schema#',
3984 + 'http://www.w3.org/2003/01/geo/wgs84_pos#',
3985 + 'xmlns' => 'http://xmlns.com/foaf/0.1/'));
3986 hunk ./actions/foaf.php 62
3987 - # This is the document about the user
3988 + # This is the document about the user
3989 hunk ./actions/foaf.php 64
3990 - $this->show_ppd('', $user->uri);
3991 + $this->show_ppd('', $user->uri);
3992 hunk ./actions/foaf.php 66
3993 - # XXX: might not be a person
3994 - common_element_start('Person', array('rdf:about' =>
3996 - common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
3997 - if ($profile->fullname) {
3998 - common_element('name', NULL, $profile->fullname);
4000 - if ($profile->homepage) {
4001 - common_element('homepage', array('rdf:resource' => $profile->homepage));
4003 - if ($profile->bio) {
4004 - common_element('rdfs:comment', NULL, $profile->bio);
4006 - # XXX: more structured location data
4007 - if ($profile->location) {
4008 - common_element_start('based_near');
4009 - common_element_start('geo:SpatialThing');
4010 - common_element('name', NULL, $profile->location);
4011 - common_element_end('geo:SpatialThing');
4012 - common_element_end('based_near');
4014 + # XXX: might not be a person
4015 + common_element_start('Person', array('rdf:about' =>
4017 + common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
4018 + if ($profile->fullname) {
4019 + common_element('name', NULL, $profile->fullname);
4021 + if ($profile->homepage) {
4022 + common_element('homepage', array('rdf:resource' => $profile->homepage));
4024 + if ($profile->bio) {
4025 + common_element('rdfs:comment', NULL, $profile->bio);
4027 + # XXX: more structured location data
4028 + if ($profile->location) {
4029 + common_element_start('based_near');
4030 + common_element_start('geo:SpatialThing');
4031 + common_element('name', NULL, $profile->location);
4032 + common_element_end('geo:SpatialThing');
4033 + common_element_end('based_near');
4035 hunk ./actions/foaf.php 88
4036 - $this->show_microblogging_account($profile, common_root_url());
4037 + $this->show_microblogging_account($profile, common_root_url());
4038 hunk ./actions/foaf.php 90
4039 - $avatar = $profile->getOriginalAvatar();
4040 + $avatar = $profile->getOriginalAvatar();
4041 hunk ./actions/foaf.php 92
4043 - common_element_start('img');
4044 - common_element_start('Image', array('rdf:about' => $avatar->url));
4045 - foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
4046 - $scaled = $profile->getAvatar($size);
4047 - if (!$scaled->original) { # sometimes the original has one of our scaled sizes
4048 - common_element_start('thumbnail');
4049 - common_element('Image', array('rdf:about' => $scaled->url));
4050 - common_element_end('thumbnail');
4053 - common_element_end('Image');
4054 - common_element_end('img');
4057 + common_element_start('img');
4058 + common_element_start('Image', array('rdf:about' => $avatar->url));
4059 + foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
4060 + $scaled = $profile->getAvatar($size);
4061 + if (!$scaled->original) { # sometimes the original has one of our scaled sizes
4062 + common_element_start('thumbnail');
4063 + common_element('Image', array('rdf:about' => $scaled->url));
4064 + common_element_end('thumbnail');
4067 + common_element_end('Image');
4068 + common_element_end('img');
4070 hunk ./actions/foaf.php 107
4071 - # Get people user is subscribed to
4072 + # Get people user is subscribed to
4073 hunk ./actions/foaf.php 109
4074 - $person = array();
4075 + $person = array();
4076 hunk ./actions/foaf.php 111
4077 - $sub = new Subscription();
4078 - $sub->subscriber = $profile->id;
4079 - $sub->whereAdd('subscriber != subscribed');
4081 - if ($sub->find()) {
4082 - while ($sub->fetch()) {
4083 - if ($sub->token) {
4084 - $other = Remote_profile::staticGet('id', $sub->subscribed);
4086 - $other = User::staticGet('id', $sub->subscribed);
4089 - common_debug('Got a bad subscription: '.print_r($sub,TRUE));
4092 - common_element('knows', array('rdf:resource' => $other->uri));
4093 - $person[$other->uri] = array(LISTENEE, $other);
4096 + $sub = new Subscription();
4097 + $sub->subscriber = $profile->id;
4098 + $sub->whereAdd('subscriber != subscribed');
4100 + if ($sub->find()) {
4101 + while ($sub->fetch()) {
4102 + if ($sub->token) {
4103 + $other = Remote_profile::staticGet('id', $sub->subscribed);
4105 + $other = User::staticGet('id', $sub->subscribed);
4108 + common_debug('Got a bad subscription: '.print_r($sub,TRUE));
4111 + common_element('knows', array('rdf:resource' => $other->uri));
4112 + $person[$other->uri] = array(LISTENEE, $other);
4115 hunk ./actions/foaf.php 131
4116 - # Get people who subscribe to user
4117 + # Get people who subscribe to user
4118 hunk ./actions/foaf.php 133
4119 - $sub = new Subscription();
4120 - $sub->subscribed = $profile->id;
4121 - $sub->whereAdd('subscriber != subscribed');
4122 + $sub = new Subscription();
4123 + $sub->subscribed = $profile->id;
4124 + $sub->whereAdd('subscriber != subscribed');
4125 hunk ./actions/foaf.php 137
4126 - if ($sub->find()) {
4127 - while ($sub->fetch()) {
4128 - if ($sub->token) {
4129 - $other = Remote_profile::staticGet('id', $sub->subscriber);
4131 - $other = User::staticGet('id', $sub->subscriber);
4134 - common_debug('Got a bad subscription: '.print_r($sub,TRUE));
4137 - if (array_key_exists($other->uri, $person)) {
4138 - $person[$other->uri][0] = BOTH;
4140 - $person[$other->uri] = array(LISTENER, $other);
4144 + if ($sub->find()) {
4145 + while ($sub->fetch()) {
4146 + if ($sub->token) {
4147 + $other = Remote_profile::staticGet('id', $sub->subscriber);
4149 + $other = User::staticGet('id', $sub->subscriber);
4152 + common_debug('Got a bad subscription: '.print_r($sub,TRUE));
4155 + if (array_key_exists($other->uri, $person)) {
4156 + $person[$other->uri][0] = BOTH;
4158 + $person[$other->uri] = array(LISTENER, $other);
4162 hunk ./actions/foaf.php 156
4163 - common_element_end('Person');
4164 + common_element_end('Person');
4165 hunk ./actions/foaf.php 158
4166 - foreach ($person as $uri => $p) {
4168 - if ($p[1] instanceof User) {
4169 - $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
4171 - $profile = Profile::staticGet($p[1]->id);
4172 - common_element_start('Person', array('rdf:about' => $uri));
4173 - if ($p[0] == LISTENER || $p[0] == BOTH) {
4174 - common_element('knows', array('rdf:resource' => $user->uri));
4176 - $this->show_microblogging_account($profile, ($p[1] instanceof User) ?
4177 - common_root_url() : NULL);
4179 - common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
4181 - common_element_end('Person');
4183 - $this->show_ppd($foaf_url, $uri);
4186 + foreach ($person as $uri => $p) {
4188 + if ($p[1] instanceof User) {
4189 + $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
4191 + $profile = Profile::staticGet($p[1]->id);
4192 + common_element_start('Person', array('rdf:about' => $uri));
4193 + if ($p[0] == LISTENER || $p[0] == BOTH) {
4194 + common_element('knows', array('rdf:resource' => $user->uri));
4196 + $this->show_microblogging_account($profile, ($p[1] instanceof User) ?
4197 + common_root_url() : NULL);
4199 + common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
4201 + common_element_end('Person');
4203 + $this->show_ppd($foaf_url, $uri);
4206 hunk ./actions/foaf.php 179
4207 - common_element_end('rdf:RDF');
4209 + common_element_end('rdf:RDF');
4211 hunk ./actions/foaf.php 182
4212 - function show_ppd($foaf_url, $person_uri) {
4213 - common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
4214 - common_element('maker', array('rdf:resource' => $person_uri));
4215 - common_element('primaryTopic', array('rdf:resource' => $person_uri));
4216 - common_element_end('PersonalProfileDocument');
4218 + function show_ppd($foaf_url, $person_uri) {
4219 + common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
4220 + common_element('maker', array('rdf:resource' => $person_uri));
4221 + common_element('primaryTopic', array('rdf:resource' => $person_uri));
4222 + common_element_end('PersonalProfileDocument');
4224 hunk ./actions/foaf.php 189
4225 - function show_microblogging_account($profile, $service=NULL) {
4227 - common_element_start('holdsAccount');
4228 - common_element_start('OnlineAccount');
4230 - common_element('accountServiceHomepage', array('rdf:resource' =>
4233 - common_element('accountName', NULL, $profile->nickname);
4234 - common_element('homepage', array('rdf:resource' => $profile->profileurl));
4235 - common_element_end('OnlineAccount');
4236 - common_element_end('holdsAccount');
4238 + function show_microblogging_account($profile, $service=NULL) {
4240 + common_element_start('holdsAccount');
4241 + common_element_start('OnlineAccount');
4243 + common_element('accountServiceHomepage', array('rdf:resource' =>
4246 + common_element('accountName', NULL, $profile->nickname);
4247 + common_element('homepage', array('rdf:resource' => $profile->profileurl));
4248 + common_element_end('OnlineAccount');
4249 + common_element_end('holdsAccount');
4251 hunk ./actions/imsettings.php 27
4252 - function get_instructions() {
4253 - return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
4255 + function get_instructions() {
4256 + return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
4258 hunk ./actions/imsettings.php 31
4259 - function show_form($msg=NULL, $success=false) {
4260 - $user = common_current_user();
4261 - $this->form_header(_('IM Settings'), $msg, $success);
4262 - common_element_start('form', array('method' => 'post',
4263 - 'id' => 'imsettings',
4265 - common_local_url('imsettings')));
4266 - common_hidden('token', common_session_token());
4267 + function show_form($msg=NULL, $success=false) {
4268 + $user = common_current_user();
4269 + $this->form_header(_('IM Settings'), $msg, $success);
4270 + common_element_start('form', array('method' => 'post',
4271 + 'id' => 'imsettings',
4273 + common_local_url('imsettings')));
4274 + common_hidden('token', common_session_token());
4275 hunk ./actions/imsettings.php 40
4276 - common_element('h2', NULL, _('Address'));
4277 + common_element('h2', NULL, _('Address'));
4278 hunk ./actions/imsettings.php 42
4279 - if ($user->jabber) {
4280 - common_element_start('p');
4281 - common_element('span', 'address confirmed', $user->jabber);
4282 - common_element('span', 'input_instructions',
4283 - _('Current confirmed Jabber/GTalk address.'));
4284 - common_hidden('jabber', $user->jabber);
4285 - common_element_end('p');
4286 - common_submit('remove', _('Remove'));
4288 - $confirm = $this->get_confirmation();
4290 - common_element_start('p');
4291 - common_element('span', 'address unconfirmed', $confirm->address);
4292 - common_element('span', 'input_instructions',
4293 - sprintf(_('Awaiting confirmation on this address. Check your Jabber/GTalk account for a message with further instructions. (Did you add %s to your buddy list?)'), jabber_daemon_address()));
4294 - common_hidden('jabber', $confirm->address);
4295 - common_element_end('p');
4296 - common_submit('cancel', _('Cancel'));
4298 - common_input('jabber', _('IM Address'),
4299 - ($this->arg('jabber')) ? $this->arg('jabber') : NULL,
4300 - sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
4301 - common_submit('add', _('Add'));
4304 + if ($user->jabber) {
4305 + common_element_start('p');
4306 + common_element('span', 'address confirmed', $user->jabber);
4307 + common_element('span', 'input_instructions',
4308 + _('Current confirmed Jabber/GTalk address.'));
4309 + common_hidden('jabber', $user->jabber);
4310 + common_element_end('p');
4311 + common_submit('remove', _('Remove'));
4313 + $confirm = $this->get_confirmation();
4315 + common_element_start('p');
4316 + common_element('span', 'address unconfirmed', $confirm->address);
4317 + common_element('span', 'input_instructions',
4318 + sprintf(_('Awaiting confirmation on this address. Check your Jabber/GTalk account for a message with further instructions. (Did you add %s to your buddy list?)'), jabber_daemon_address()));
4319 + common_hidden('jabber', $confirm->address);
4320 + common_element_end('p');
4321 + common_submit('cancel', _('Cancel'));
4323 + common_input('jabber', _('IM Address'),
4324 + ($this->arg('jabber')) ? $this->arg('jabber') : NULL,
4325 + sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
4326 + common_submit('add', _('Add'));
4329 hunk ./actions/imsettings.php 68
4330 - common_element('h2', NULL, _('Preferences'));
4331 + common_element('h2', NULL, _('Preferences'));
4332 hunk ./actions/imsettings.php 70
4333 - common_checkbox('jabbernotify',
4334 - _('Send me notices through Jabber/GTalk.'),
4335 - $user->jabbernotify);
4336 - common_checkbox('updatefrompresence',
4337 - _('Post a notice when my Jabber/GTalk status changes.'),
4338 - $user->updatefrompresence);
4339 - common_checkbox('jabberreplies',
4340 - _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
4341 - $user->jabberreplies);
4342 - common_checkbox('jabbermicroid',
4343 - _('Publish a MicroID for my Jabber/GTalk address.'),
4344 - $user->jabbermicroid);
4345 - common_submit('save', _('Save'));
4346 + common_checkbox('jabbernotify',
4347 + _('Send me notices through Jabber/GTalk.'),
4348 + $user->jabbernotify);
4349 + common_checkbox('updatefrompresence',
4350 + _('Post a notice when my Jabber/GTalk status changes.'),
4351 + $user->updatefrompresence);
4352 + common_checkbox('jabberreplies',
4353 + _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
4354 + $user->jabberreplies);
4355 + common_checkbox('jabbermicroid',
4356 + _('Publish a MicroID for my Jabber/GTalk address.'),
4357 + $user->jabbermicroid);
4358 + common_submit('save', _('Save'));
4359 hunk ./actions/imsettings.php 84
4360 - common_element_end('form');
4361 - common_show_footer();
4363 + common_element_end('form');
4364 + common_show_footer();
4366 hunk ./actions/imsettings.php 88
4367 - function get_confirmation() {
4368 - $user = common_current_user();
4369 - $confirm = new Confirm_address();
4370 - $confirm->user_id = $user->id;
4371 - $confirm->address_type = 'jabber';
4372 - if ($confirm->find(TRUE)) {
4378 + function get_confirmation() {
4379 + $user = common_current_user();
4380 + $confirm = new Confirm_address();
4381 + $confirm->user_id = $user->id;
4382 + $confirm->address_type = 'jabber';
4383 + if ($confirm->find(TRUE)) {
4389 hunk ./actions/imsettings.php 100
4390 - function handle_post() {
4391 + function handle_post() {
4392 hunk ./actions/imsettings.php 102
4394 - $token = $this->trimmed('token');
4395 - if (!$token || $token != common_session_token()) {
4396 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
4400 + $token = $this->trimmed('token');
4401 + if (!$token || $token != common_session_token()) {
4402 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
4405 hunk ./actions/imsettings.php 109
4406 - if ($this->arg('save')) {
4407 - $this->save_preferences();
4408 - } else if ($this->arg('add')) {
4409 - $this->add_address();
4410 - } else if ($this->arg('cancel')) {
4411 - $this->cancel_confirmation();
4412 - } else if ($this->arg('remove')) {
4413 - $this->remove_address();
4415 - $this->show_form(_('Unexpected form submission.'));
4418 + if ($this->arg('save')) {
4419 + $this->save_preferences();
4420 + } else if ($this->arg('add')) {
4421 + $this->add_address();
4422 + } else if ($this->arg('cancel')) {
4423 + $this->cancel_confirmation();
4424 + } else if ($this->arg('remove')) {
4425 + $this->remove_address();
4427 + $this->show_form(_('Unexpected form submission.'));
4430 hunk ./actions/imsettings.php 122
4431 - function save_preferences() {
4432 + function save_preferences() {
4433 hunk ./actions/imsettings.php 124
4434 - $jabbernotify = $this->boolean('jabbernotify');
4435 - $updatefrompresence = $this->boolean('updatefrompresence');
4436 - $jabberreplies = $this->boolean('jabberreplies');
4437 - $jabbermicroid = $this->boolean('jabbermicroid');
4438 + $jabbernotify = $this->boolean('jabbernotify');
4439 + $updatefrompresence = $this->boolean('updatefrompresence');
4440 + $jabberreplies = $this->boolean('jabberreplies');
4441 + $jabbermicroid = $this->boolean('jabbermicroid');
4442 hunk ./actions/imsettings.php 129
4443 - $user = common_current_user();
4444 + $user = common_current_user();
4445 hunk ./actions/imsettings.php 131
4446 - assert(!is_null($user)); # should already be checked
4447 + assert(!is_null($user)); # should already be checked
4448 hunk ./actions/imsettings.php 133
4449 - $user->query('BEGIN');
4450 + $user->query('BEGIN');
4451 hunk ./actions/imsettings.php 135
4452 - $original = clone($user);
4453 + $original = clone($user);
4454 hunk ./actions/imsettings.php 137
4455 - $user->jabbernotify = $jabbernotify;
4456 - $user->updatefrompresence = $updatefrompresence;
4457 - $user->jabberreplies = $jabberreplies;
4458 - $user->jabbermicroid = $jabbermicroid;
4459 + $user->jabbernotify = $jabbernotify;
4460 + $user->updatefrompresence = $updatefrompresence;
4461 + $user->jabberreplies = $jabberreplies;
4462 + $user->jabbermicroid = $jabbermicroid;
4463 hunk ./actions/imsettings.php 142
4464 - $result = $user->update($original);
4465 + $result = $user->update($original);
4466 hunk ./actions/imsettings.php 144
4467 - if ($result === FALSE) {
4468 - common_log_db_error($user, 'UPDATE', __FILE__);
4469 - common_server_error(_('Couldn\'t update user.'));
4472 + if ($result === FALSE) {
4473 + common_log_db_error($user, 'UPDATE', __FILE__);
4474 + common_server_error(_('Couldn\'t update user.'));
4477 hunk ./actions/imsettings.php 150
4478 - $user->query('COMMIT');
4479 + $user->query('COMMIT');
4480 hunk ./actions/imsettings.php 152
4481 - $this->show_form(_('Preferences saved.'), true);
4483 + $this->show_form(_('Preferences saved.'), true);
4485 hunk ./actions/imsettings.php 155
4486 - function add_address() {
4487 + function add_address() {
4488 hunk ./actions/imsettings.php 157
4489 - $user = common_current_user();
4490 + $user = common_current_user();
4491 hunk ./actions/imsettings.php 159
4492 - $jabber = $this->trimmed('jabber');
4493 + $jabber = $this->trimmed('jabber');
4494 hunk ./actions/imsettings.php 161
4497 hunk ./actions/imsettings.php 163
4499 - $this->show_form(_('No Jabber ID.'));
4503 + $this->show_form(_('No Jabber ID.'));
4506 hunk ./actions/imsettings.php 168
4507 - $jabber = jabber_normalize_jid($jabber);
4508 + $jabber = jabber_normalize_jid($jabber);
4509 hunk ./actions/imsettings.php 170
4511 - $this->show_form(_('Cannot normalize that Jabber ID'));
4514 - if (!jabber_valid_base_jid($jabber)) {
4515 - $this->show_form(_('Not a valid Jabber ID'));
4517 - } else if ($user->jabber == $jabber) {
4518 - $this->show_form(_('That is already your Jabber ID.'));
4520 - } else if ($this->jabber_exists($jabber)) {
4521 - $this->show_form(_('Jabber ID already belongs to another user.'));
4525 + $this->show_form(_('Cannot normalize that Jabber ID'));
4528 + if (!jabber_valid_base_jid($jabber)) {
4529 + $this->show_form(_('Not a valid Jabber ID'));
4531 + } else if ($user->jabber == $jabber) {
4532 + $this->show_form(_('That is already your Jabber ID.'));
4534 + } else if ($this->jabber_exists($jabber)) {
4535 + $this->show_form(_('Jabber ID already belongs to another user.'));
4538 hunk ./actions/imsettings.php 185
4539 - $confirm = new Confirm_address();
4540 - $confirm->address = $jabber;
4541 - $confirm->address_type = 'jabber';
4542 - $confirm->user_id = $user->id;
4543 - $confirm->code = common_confirmation_code(64);
4544 + $confirm = new Confirm_address();
4545 + $confirm->address = $jabber;
4546 + $confirm->address_type = 'jabber';
4547 + $confirm->user_id = $user->id;
4548 + $confirm->code = common_confirmation_code(64);
4549 hunk ./actions/imsettings.php 191
4550 - $result = $confirm->insert();
4551 + $result = $confirm->insert();
4552 hunk ./actions/imsettings.php 193
4553 - if ($result === FALSE) {
4554 - common_log_db_error($confirm, 'INSERT', __FILE__);
4555 - common_server_error(_('Couldn\'t insert confirmation code.'));
4558 + if ($result === FALSE) {
4559 + common_log_db_error($confirm, 'INSERT', __FILE__);
4560 + common_server_error(_('Couldn\'t insert confirmation code.'));
4563 hunk ./actions/imsettings.php 199
4564 - if (!common_config('queue', 'enabled')) {
4565 - jabber_confirm_address($confirm->code,
4569 + if (!common_config('queue', 'enabled')) {
4570 + jabber_confirm_address($confirm->code,
4574 hunk ./actions/imsettings.php 205
4575 - $msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address());
4576 + $msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address());
4577 hunk ./actions/imsettings.php 207
4578 - $this->show_form($msg, TRUE);
4580 + $this->show_form($msg, TRUE);
4582 hunk ./actions/imsettings.php 210
4583 - function cancel_confirmation() {
4584 - $jabber = $this->arg('jabber');
4585 - $confirm = $this->get_confirmation();
4587 - $this->show_form(_('No pending confirmation to cancel.'));
4590 - if ($confirm->address != $jabber) {
4591 - $this->show_form(_('That is the wrong IM address.'));
4594 + function cancel_confirmation() {
4595 + $jabber = $this->arg('jabber');
4596 + $confirm = $this->get_confirmation();
4598 + $this->show_form(_('No pending confirmation to cancel.'));
4601 + if ($confirm->address != $jabber) {
4602 + $this->show_form(_('That is the wrong IM address.'));
4605 hunk ./actions/imsettings.php 225
4606 - common_log_db_error($confirm, 'DELETE', __FILE__);
4607 + common_log_db_error($confirm, 'DELETE', __FILE__);
4608 hunk ./actions/imsettings.php 231
4611 hunk ./actions/imsettings.php 233
4612 - function remove_address() {
4613 + function remove_address() {
4614 hunk ./actions/imsettings.php 235
4615 - $user = common_current_user();
4616 - $jabber = $this->arg('jabber');
4617 + $user = common_current_user();
4618 + $jabber = $this->arg('jabber');
4619 hunk ./actions/imsettings.php 238
4620 - # Maybe an old tab open...?
4621 + # Maybe an old tab open...?
4622 hunk ./actions/imsettings.php 240
4623 - if ($user->jabber != $jabber) {
4624 - $this->show_form(_('That is not your Jabber ID.'));
4627 + if ($user->jabber != $jabber) {
4628 + $this->show_form(_('That is not your Jabber ID.'));
4631 hunk ./actions/imsettings.php 245
4632 - $user->query('BEGIN');
4633 - $original = clone($user);
4634 - $user->jabber = NULL;
4635 - $result = $user->updateKeys($original);
4637 - common_log_db_error($user, 'UPDATE', __FILE__);
4638 - common_server_error(_('Couldn\'t update user.'));
4641 - $user->query('COMMIT');
4642 + $user->query('BEGIN');
4643 + $original = clone($user);
4644 + $user->jabber = NULL;
4645 + $result = $user->updateKeys($original);
4647 + common_log_db_error($user, 'UPDATE', __FILE__);
4648 + common_server_error(_('Couldn\'t update user.'));
4651 + $user->query('COMMIT');
4652 hunk ./actions/imsettings.php 256
4653 - # XXX: unsubscribe to the old address
4654 + # XXX: unsubscribe to the old address
4655 hunk ./actions/imsettings.php 258
4656 - $this->show_form(_('The address was removed.'), TRUE);
4658 + $this->show_form(_('The address was removed.'), TRUE);
4660 hunk ./actions/imsettings.php 261
4661 - function jabber_exists($jabber) {
4662 - $user = common_current_user();
4663 - $other = User::staticGet('jabber', $jabber);
4667 - return $other->id != $user->id;
4670 + function jabber_exists($jabber) {
4671 + $user = common_current_user();
4672 + $other = User::staticGet('jabber', $jabber);
4676 + return $other->id != $user->id;
4679 hunk ./actions/invite.php 24
4680 - function is_readonly() {
4683 + function is_readonly() {
4686 hunk ./actions/invite.php 30
4687 - if (!common_logged_in()) {
4688 - $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
4689 - common_config('site', 'name')));
4691 - } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
4692 - $this->send_invitations();
4694 - $this->show_form();
4697 + if (!common_logged_in()) {
4698 + $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
4699 + common_config('site', 'name')));
4701 + } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
4702 + $this->send_invitations();
4704 + $this->show_form();
4707 hunk ./actions/invite.php 41
4708 - function send_invitations() {
4709 + function send_invitations() {
4710 hunk ./actions/invite.php 43
4712 - $token = $this->trimmed('token');
4713 - if (!$token || $token != common_session_token()) {
4714 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
4718 + $token = $this->trimmed('token');
4719 + if (!$token || $token != common_session_token()) {
4720 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
4723 hunk ./actions/invite.php 50
4724 - $user = common_current_user();
4725 - $profile = $user->getProfile();
4726 + $user = common_current_user();
4727 + $profile = $user->getProfile();
4728 hunk ./actions/invite.php 53
4729 - $bestname = $profile->getBestName();
4730 - $sitename = common_config('site', 'name');
4731 - $personal = $this->trimmed('personal');
4732 + $bestname = $profile->getBestName();
4733 + $sitename = common_config('site', 'name');
4734 + $personal = $this->trimmed('personal');
4735 hunk ./actions/invite.php 57
4736 - $addresses = explode("\n", $this->trimmed('addresses'));
4737 + $addresses = explode("\n", $this->trimmed('addresses'));
4738 hunk ./actions/invite.php 59
4739 - foreach ($addresses as $email) {
4740 - $email = trim($email);
4741 - if (!Validate::email($email, true)) {
4742 - $this->show_form(sprintf(_('Invalid email address: %s'), $email));
4746 + foreach ($addresses as $email) {
4747 + $email = trim($email);
4748 + if (!Validate::email($email, true)) {
4749 + $this->show_form(sprintf(_('Invalid email address: %s'), $email));
4753 hunk ./actions/invite.php 67
4754 - $already = array();
4755 - $subbed = array();
4756 + $already = array();
4757 + $subbed = array();
4758 hunk ./actions/invite.php 70
4759 - foreach ($addresses as $email) {
4760 - $email = common_canonical_email($email);
4761 - $other = User::staticGet('email', $email);
4763 - if ($user->isSubscribed($other)) {
4764 - $already[] = $other;
4766 - subs_subscribe_to($user, $other);
4767 - $subbed[] = $other;
4771 - $this->send_invitation($email, $user, $personal);
4774 + foreach ($addresses as $email) {
4775 + $email = common_canonical_email($email);
4776 + $other = User::staticGet('email', $email);
4778 + if ($user->isSubscribed($other)) {
4779 + $already[] = $other;
4781 + subs_subscribe_to($user, $other);
4782 + $subbed[] = $other;
4786 + $this->send_invitation($email, $user, $personal);
4789 hunk ./actions/invite.php 86
4790 - common_show_header(_('Invitation(s) sent'));
4792 - common_element('p', NULL, _('You are already subscribed to these users:'));
4793 - common_element_start('ul');
4794 - foreach ($already as $other) {
4795 - common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
4797 - common_element_end('ul');
4800 - common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
4801 - common_element_start('ul');
4802 - foreach ($subbed as $other) {
4803 - common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
4805 - common_element_end('ul');
4808 - common_element('p', NULL, _('Invitation(s) sent to the following people:'));
4809 - common_element_start('ul');
4810 - foreach ($sent as $other) {
4811 - common_element('li', NULL, $other);
4813 - common_element_end('ul');
4814 - common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
4816 - common_show_footer();
4818 + common_show_header(_('Invitation(s) sent'));
4820 + common_element('p', NULL, _('You are already subscribed to these users:'));
4821 + common_element_start('ul');
4822 + foreach ($already as $other) {
4823 + common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
4825 + common_element_end('ul');
4828 + common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
4829 + common_element_start('ul');
4830 + foreach ($subbed as $other) {
4831 + common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
4833 + common_element_end('ul');
4836 + common_element('p', NULL, _('Invitation(s) sent to the following people:'));
4837 + common_element_start('ul');
4838 + foreach ($sent as $other) {
4839 + common_element('li', NULL, $other);
4841 + common_element_end('ul');
4842 + common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
4844 + common_show_footer();
4846 hunk ./actions/invite.php 115
4847 - function show_top($error=NULL) {
4849 - common_element('p', 'error', $error);
4851 - common_element_start('div', 'instructions');
4852 - common_element('p', NULL,
4853 - _('Use this form to invite your friends and colleagues to use this service.'));
4854 - common_element_end('div');
4857 + function show_top($error=NULL) {
4859 + common_element('p', 'error', $error);
4861 + common_element_start('div', 'instructions');
4862 + common_element('p', NULL,
4863 + _('Use this form to invite your friends and colleagues to use this service.'));
4864 + common_element_end('div');
4867 hunk ./actions/invite.php 126
4868 - function show_form($error=NULL) {
4869 + function show_form($error=NULL) {
4870 hunk ./actions/invite.php 128
4873 hunk ./actions/invite.php 130
4874 - common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
4875 + common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
4876 hunk ./actions/invite.php 132
4877 - common_element_start('form', array('method' => 'post',
4879 - 'action' => common_local_url('invite')));
4880 - common_hidden('token', common_session_token());
4881 + common_element_start('form', array('method' => 'post',
4883 + 'action' => common_local_url('invite')));
4884 + common_hidden('token', common_session_token());
4885 hunk ./actions/invite.php 137
4886 - common_textarea('addresses', _('Email addresses'),
4887 - $this->trimmed('addresses'),
4888 - _('Addresses of friends to invite (one per line)'));
4889 + common_textarea('addresses', _('Email addresses'),
4890 + $this->trimmed('addresses'),
4891 + _('Addresses of friends to invite (one per line)'));
4892 hunk ./actions/invite.php 141
4893 - common_textarea('personal', _('Personal message'),
4894 - $this->trimmed('personal'),
4895 - _('Optionally add a personal message to the invitation.'));
4896 + common_textarea('personal', _('Personal message'),
4897 + $this->trimmed('personal'),
4898 + _('Optionally add a personal message to the invitation.'));
4899 hunk ./actions/invite.php 145
4900 - common_submit('send', _('Send'));
4901 + common_submit('send', _('Send'));
4902 hunk ./actions/invite.php 147
4903 - common_element_end('form');
4904 + common_element_end('form');
4905 hunk ./actions/invite.php 149
4906 - common_show_footer();
4908 + common_show_footer();
4910 hunk ./actions/invite.php 152
4911 - function send_invitation($email, $user, $personal) {
4912 + function send_invitation($email, $user, $personal) {
4913 hunk ./actions/invite.php 154
4914 - $profile = $user->getProfile();
4915 - $bestname = $profile->getBestName();
4916 + $profile = $user->getProfile();
4917 + $bestname = $profile->getBestName();
4918 hunk ./actions/invite.php 157
4919 - $sitename = common_config('site', 'name');
4920 + $sitename = common_config('site', 'name');
4921 hunk ./actions/invite.php 159
4922 - $invite = new Invitation();
4923 + $invite = new Invitation();
4924 hunk ./actions/invite.php 161
4925 - $invite->address = $email;
4926 - $invite->address_type = 'email';
4927 - $invite->code = common_confirmation_code(128);
4928 - $invite->user_id = $user->id;
4929 - $invite->created = common_sql_now();
4930 + $invite->address = $email;
4931 + $invite->address_type = 'email';
4932 + $invite->code = common_confirmation_code(128);
4933 + $invite->user_id = $user->id;
4934 + $invite->created = common_sql_now();
4935 hunk ./actions/invite.php 167
4936 - if (!$invite->insert()) {
4937 - common_log_db_error($invite, 'INSERT', __FILE__);
4940 + if (!$invite->insert()) {
4941 + common_log_db_error($invite, 'INSERT', __FILE__);
4944 hunk ./actions/invite.php 172
4945 - $recipients = array($email);
4946 + $recipients = array($email);
4947 hunk ./actions/invite.php 174
4948 - $headers['From'] = mail_notify_from();
4949 - $headers['To'] = $email;
4950 - $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
4951 + $headers['From'] = mail_notify_from();
4952 + $headers['To'] = $email;
4953 + $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
4954 hunk ./actions/invite.php 178
4955 - $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n".
4956 - "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n".
4957 - "You can also share news about yourself, your thoughts, or your life online with people who know about you. ".
4958 - "It's also great for meeting new people who share your interests.\n\n".
4959 - "%1\$s said:\n\n%4\$s\n\n".
4960 - "You can see %1\$s's profile page on %2\$s here:\n\n".
4962 - "If you'd like to try the service, click on the link below to accept the invitation.\n\n".
4964 - "If not, you can ignore this message. Thanks for your patience and your time.\n\n".
4965 - "Sincerely, %2\$s\n"),
4968 - common_root_url(),
4970 - common_local_url('showstream', array('nickname' => $user->nickname)),
4971 - common_local_url('register', array('code' => $invite->code)));
4972 + $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n".
4973 + "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n".
4974 + "You can also share news about yourself, your thoughts, or your life online with people who know about you. ".
4975 + "It's also great for meeting new people who share your interests.\n\n".
4976 + "%1\$s said:\n\n%4\$s\n\n".
4977 + "You can see %1\$s's profile page on %2\$s here:\n\n".
4979 + "If you'd like to try the service, click on the link below to accept the invitation.\n\n".
4981 + "If not, you can ignore this message. Thanks for your patience and your time.\n\n".
4982 + "Sincerely, %2\$s\n"),
4985 + common_root_url(),
4987 + common_local_url('showstream', array('nickname' => $user->nickname)),
4988 + common_local_url('register', array('code' => $invite->code)));
4989 hunk ./actions/invite.php 196
4990 - mail_send($recipients, $headers, $body);
4992 + mail_send($recipients, $headers, $body);
4994 hunk ./actions/login.php 24
4995 - function is_readonly() {
4998 + function is_readonly() {
5001 hunk ./actions/login.php 28
5002 - function handle($args) {
5003 - parent::handle($args);
5004 - if (common_is_real_login()) {
5005 - common_user_error(_('Already logged in.'));
5006 - } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
5007 - $this->check_login();
5009 - $this->show_form();
5012 + function handle($args) {
5013 + parent::handle($args);
5014 + if (common_is_real_login()) {
5015 + common_user_error(_('Already logged in.'));
5016 + } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
5017 + $this->check_login();
5019 + $this->show_form();
5022 hunk ./actions/login.php 39
5023 - function check_login() {
5024 - # XXX: login throttle
5025 + function check_login() {
5026 + # XXX: login throttle
5027 hunk ./actions/login.php 42
5028 - # CSRF protection - token set in common_notice_form()
5029 - $token = $this->trimmed('token');
5030 - if (!$token || $token != common_session_token()) {
5031 - $this->client_error(_('There was a problem with your session token. Try again, please.'));
5034 + # CSRF protection - token set in common_notice_form()
5035 + $token = $this->trimmed('token');
5036 + if (!$token || $token != common_session_token()) {
5037 + $this->client_error(_('There was a problem with your session token. Try again, please.'));
5040 hunk ./actions/login.php 49
5041 - $nickname = common_canonical_nickname($this->trimmed('nickname'));
5042 - $password = $this->arg('password');
5043 - if (common_check_user($nickname, $password)) {
5045 - if (!common_set_user($nickname)) {
5046 - common_server_error(_('Error setting user.'));
5049 - common_real_login(true);
5050 - if ($this->boolean('rememberme')) {
5051 - common_debug('Adding rememberme cookie for ' . $nickname);
5052 - common_rememberme();
5055 - $url = common_get_returnto();
5057 - # We don't have to return to it again
5058 - common_set_returnto(NULL);
5060 - $url = common_local_url('all',
5061 - array('nickname' =>
5064 - common_redirect($url);
5066 - $this->show_form(_('Incorrect username or password.'));
5069 + $nickname = common_canonical_nickname($this->trimmed('nickname'));
5070 + $password = $this->arg('password');
5071 + if (common_check_user($nickname, $password)) {
5073 + if (!common_set_user($nickname)) {
5074 + common_server_error(_('Error setting user.'));
5077 + common_real_login(true);
5078 + if ($this->boolean('rememberme')) {
5079 + common_debug('Adding rememberme cookie for ' . $nickname);
5080 + common_rememberme();
5083 + $url = common_get_returnto();
5085 + # We don't have to return to it again
5086 + common_set_returnto(NULL);
5088 + $url = common_local_url('all',
5089 + array('nickname' =>
5092 + common_redirect($url);
5094 + $this->show_form(_('Incorrect username or password.'));
5097 hunk ./actions/login.php 78
5099 - if (!common_set_user($user)) {
5100 - common_server_error(_('Error setting user.'));
5104 + if (!common_set_user($user)) {
5105 + common_server_error(_('Error setting user.'));
5108 hunk ./actions/login.php 84
5109 - common_real_login(true);
5110 + common_real_login(true);
5111 hunk ./actions/login.php 86
5112 - if ($this->boolean('rememberme')) {
5113 - common_debug('Adding rememberme cookie for ' . $nickname);
5114 - common_rememberme($user);
5117 - $url = common_get_returnto();
5119 - # We don't have to return to it again
5120 - common_set_returnto(NULL);
5122 - $url = common_local_url('all',
5123 - array('nickname' =>
5126 - common_redirect($url);
5128 + if ($this->boolean('rememberme')) {
5129 + common_debug('Adding rememberme cookie for ' . $nickname);
5130 + common_rememberme($user);
5133 + $url = common_get_returnto();
5135 + # We don't have to return to it again
5136 + common_set_returnto(NULL);
5138 + $url = common_local_url('all',
5139 + array('nickname' =>
5142 + common_redirect($url);
5144 hunk ./actions/login.php 103
5145 - function show_form($error=NULL) {
5146 - common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
5147 - common_element_start('form', array('method' => 'post',
5149 - 'action' => common_local_url('login')));
5150 - common_input('nickname', _('Nickname'));
5151 - common_password('password', _('Password'));
5152 - common_checkbox('rememberme', _('Remember me'), false,
5153 - _('Automatically login in the future; ' .
5154 - 'not for shared computers!'));
5155 - common_submit('submit', _('Login'));
5156 - common_hidden('token', common_session_token());
5157 - common_element_end('form');
5158 - common_element_start('p');
5159 - common_element('a', array('href' => common_local_url('recoverpassword')),
5160 - _('Lost or forgotten password?'));
5161 - common_element_end('p');
5162 - common_show_footer();
5164 + function show_form($error=NULL) {
5165 + common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
5166 + common_element_start('form', array('method' => 'post',
5168 + 'action' => common_local_url('login')));
5169 + common_input('nickname', _('Nickname'));
5170 + common_password('password', _('Password'));
5171 + common_checkbox('rememberme', _('Remember me'), false,
5172 + _('Automatically login in the future; ' .
5173 + 'not for shared computers!'));
5174 + common_submit('submit', _('Login'));
5175 + common_hidden('token', common_session_token());
5176 + common_element_end('form');
5177 + common_element_start('p');
5178 + common_element('a', array('href' => common_local_url('recoverpassword')),
5179 + _('Lost or forgotten password?'));
5180 + common_element_end('p');
5181 + common_show_footer();
5183 hunk ./actions/login.php 123
5184 - function get_instructions() {
5185 - if (common_logged_in() &&
5186 - !common_is_real_login() &&
5187 - common_get_returnto())
5189 - # rememberme logins have to reauthenticate before
5190 - # changing any profile settings (cookie-stealing protection)
5191 - return _('For security reasons, please re-enter your ' .
5192 - 'user name and password ' .
5193 - 'before changing your settings.');
5195 - return _('Login with your username and password. ' .
5196 - 'Don\'t have a username yet? ' .
5197 - '[Register](%%action.register%%) a new account, or ' .
5198 - 'try [OpenID](%%action.openidlogin%%). ');
5201 + function get_instructions() {
5202 + if (common_logged_in() &&
5203 + !common_is_real_login() &&
5204 + common_get_returnto())
5206 + # rememberme logins have to reauthenticate before
5207 + # changing any profile settings (cookie-stealing protection)
5208 + return _('For security reasons, please re-enter your ' .
5209 + 'user name and password ' .
5210 + 'before changing your settings.');
5212 + return _('Login with your username and password. ' .
5213 + 'Don\'t have a username yet? ' .
5214 + '[Register](%%action.register%%) a new account, or ' .
5215 + 'try [OpenID](%%action.openidlogin%%). ');
5218 hunk ./actions/login.php 141
5219 - function show_top($error=NULL) {
5221 - common_element('p', 'error', $error);
5223 - $instr = $this->get_instructions();
5224 - $output = common_markup_to_html($instr);
5225 - common_element_start('div', 'instructions');
5226 - common_raw($output);
5227 - common_element_end('div');
5230 + function show_top($error=NULL) {
5232 + common_element('p', 'error', $error);
5234 + $instr = $this->get_instructions();
5235 + $output = common_markup_to_html($instr);
5236 + common_element_start('div', 'instructions');
5237 + common_raw($output);
5238 + common_element_end('div');
5241 hunk ./actions/logout.php 25
5243 - function is_readonly() {
5247 - function handle($args) {
5248 - parent::handle($args);
5249 - if (!common_logged_in()) {
5250 - common_user_error(_('Not logged in.'));
5252 - common_set_user(NULL);
5253 - common_real_login(false); # not logged in
5254 - common_forgetme(); # don't log back in!
5255 - common_redirect(common_local_url('public'));
5259 + function is_readonly() {
5263 + function handle($args) {
5264 + parent::handle($args);
5265 + if (!common_logged_in()) {
5266 + common_user_error(_('Not logged in.'));
5268 + common_set_user(NULL);
5269 + common_real_login(false); # not logged in
5270 + common_forgetme(); # don't log back in!
5271 + common_redirect(common_local_url('public'));
5274 hunk ./actions/microsummary.php 24
5275 - function handle($args) {
5276 + function handle($args) {
5277 hunk ./actions/microsummary.php 26
5278 - parent::handle($args);
5279 + parent::handle($args);
5280 hunk ./actions/microsummary.php 28
5281 - $nickname = common_canonical_nickname($this->arg('nickname'));
5282 - $user = User::staticGet('nickname', $nickname);
5283 + $nickname = common_canonical_nickname($this->arg('nickname'));
5284 + $user = User::staticGet('nickname', $nickname);
5285 hunk ./actions/microsummary.php 31
5287 - $this->client_error(_('No such user'), 404);
5291 - $notice = $user->getCurrentNotice();
5294 - $this->client_error(_('No current status'), 404);
5297 - header('Content-Type: text/plain');
5299 - print $user->nickname . ': ' . $notice->content;
5302 + $this->client_error(_('No such user'), 404);
5306 + $notice = $user->getCurrentNotice();
5309 + $this->client_error(_('No current status'), 404);
5312 + header('Content-Type: text/plain');
5314 + print $user->nickname . ': ' . $notice->content;
5316 hunk ./actions/newmessage.php 23
5318 - function handle($args) {
5319 - parent::handle($args);
5321 + function handle($args) {
5322 + parent::handle($args);
5323 hunk ./actions/newmessage.php 27
5324 - if (!common_logged_in()) {
5325 - $this->client_error(_('Not logged in.'), 403);
5326 - } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
5327 - $this->save_new_message();
5329 - $this->show_form();
5332 + if (!common_logged_in()) {
5333 + $this->client_error(_('Not logged in.'), 403);
5334 + } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
5335 + $this->save_new_message();
5337 + $this->show_form();
5340 hunk ./actions/newmessage.php 36
5341 - function save_new_message() {
5342 - $user = common_current_user();
5343 - assert($user); # XXX: maybe an error instead...
5344 + function save_new_message() {
5345 + $user = common_current_user();
5346 + assert($user); # XXX: maybe an error instead...
5347 hunk ./actions/newmessage.php 40
5350 - $token = $this->trimmed('token');
5351 - if (!$token || $token != common_session_token()) {
5352 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
5356 - $content = $this->trimmed('content');
5357 - $to = $this->trimmed('to');
5360 - $this->show_form(_('No content!'));
5363 - $content_shortened = common_shorten_links($content);
5366 + $token = $this->trimmed('token');
5367 + if (!$token || $token != common_session_token()) {
5368 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
5372 + $content = $this->trimmed('content');
5373 + $to = $this->trimmed('to');
5376 + $this->show_form(_('No content!'));
5379 + $content_shortened = common_shorten_links($content);
5380 hunk ./actions/newmessage.php 57
5381 - if (mb_strlen($content_shortened) > 140) {
5382 - common_debug("Content = '$content_shortened'", __FILE__);
5383 - common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
5384 - $this->show_form(_('That\'s too long. Max message size is 140 chars.'));
5388 + if (mb_strlen($content_shortened) > 140) {
5389 + common_debug("Content = '$content_shortened'", __FILE__);
5390 + common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
5391 + $this->show_form(_('That\'s too long. Max message size is 140 chars.'));
5395 hunk ./actions/newmessage.php 65
5396 - $other = User::staticGet('id', $to);
5399 - $this->show_form(_('No recipient specified.'));
5401 - } else if (!$user->mutuallySubscribed($other)) {
5402 - $this->client_error(_('You can\'t send a message to this user.'), 404);
5404 - } else if ($user->id == $other->id) {
5405 - $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
5409 - $message = Message::saveNew($user->id, $other->id, $content, 'web');
5411 - if (is_string($message)) {
5412 - $this->show_form($message);
5415 + $other = User::staticGet('id', $to);
5418 + $this->show_form(_('No recipient specified.'));
5420 + } else if (!$user->mutuallySubscribed($other)) {
5421 + $this->client_error(_('You can\'t send a message to this user.'), 404);
5423 + } else if ($user->id == $other->id) {
5424 + $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
5428 + $message = Message::saveNew($user->id, $other->id, $content, 'web');
5430 + if (is_string($message)) {
5431 + $this->show_form($message);
5434 hunk ./actions/newmessage.php 85
5435 - $this->notify($user, $other, $message);
5436 + $this->notify($user, $other, $message);
5437 hunk ./actions/newmessage.php 87
5438 - $url = common_local_url('outbox', array('nickname' => $user->nickname));
5439 + $url = common_local_url('outbox', array('nickname' => $user->nickname));
5440 hunk ./actions/newmessage.php 89
5441 - common_redirect($url, 303);
5443 + common_redirect($url, 303);
5445 hunk ./actions/newmessage.php 92
5446 - function show_top($params) {
5447 + function show_top($params) {
5448 hunk ./actions/newmessage.php 94
5449 - list($content, $user, $to) = $params;
5451 - assert(!is_null($user));
5452 + list($content, $user, $to) = $params;
5454 + assert(!is_null($user));
5455 hunk ./actions/newmessage.php 98
5456 - common_message_form($content, $user, $to);
5458 + common_message_form($content, $user, $to);
5460 hunk ./actions/newmessage.php 101
5461 - function show_form($msg=NULL) {
5463 - $content = $this->trimmed('content');
5464 - $user = common_current_user();
5465 + function show_form($msg=NULL) {
5467 + $content = $this->trimmed('content');
5468 + $user = common_current_user();
5469 hunk ./actions/newmessage.php 106
5470 - $to = $this->trimmed('to');
5472 - $other = User::staticGet('id', $to);
5473 + $to = $this->trimmed('to');
5475 + $other = User::staticGet('id', $to);
5476 hunk ./actions/newmessage.php 110
5478 - $this->client_error(_('No such user'), 404);
5482 + $this->client_error(_('No such user'), 404);
5485 hunk ./actions/newmessage.php 115
5486 - if (!$user->mutuallySubscribed($other)) {
5487 - $this->client_error(_('You can\'t send a message to this user.'), 404);
5491 - common_show_header(_('New message'), NULL,
5492 - array($content, $user, $other),
5493 - array($this, 'show_top'));
5496 - common_element('p', array('id'=>'error'), $msg);
5499 - common_show_footer();
5502 - function notify($from, $to, $message) {
5503 - mail_notify_message($message, $from, $to);
5504 - # XXX: Jabber, SMS notifications... probably queued
5506 + if (!$user->mutuallySubscribed($other)) {
5507 + $this->client_error(_('You can\'t send a message to this user.'), 404);
5511 + common_show_header(_('New message'), NULL,
5512 + array($content, $user, $other),
5513 + array($this, 'show_top'));
5516 + common_element('p', array('id'=>'error'), $msg);
5519 + common_show_footer();
5522 + function notify($from, $to, $message) {
5523 + mail_notify_message($message, $from, $to);
5524 + # XXX: Jabber, SMS notifications... probably queued
5526 hunk ./actions/newnotice.php 13
5527 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5528 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5529 hunk ./actions/newnotice.php 17
5530 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
5531 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
5532 hunk ./actions/newnotice.php 26
5533 - function handle($args) {
5534 - parent::handle($args);
5535 + function handle($args) {
5536 + parent::handle($args);
5537 hunk ./actions/newnotice.php 29
5538 - if (!common_logged_in()) {
5539 - common_user_error(_('Not logged in.'));
5540 - } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
5541 + if (!common_logged_in()) {
5542 + common_user_error(_('Not logged in.'));
5543 + } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
5544 hunk ./actions/newnotice.php 33
5545 - # CSRF protection - token set in common_notice_form()
5546 - $token = $this->trimmed('token');
5547 - if (!$token || $token != common_session_token()) {
5548 - $this->client_error(_('There was a problem with your session token. Try again, please.'));
5551 + # CSRF protection - token set in common_notice_form()
5552 + $token = $this->trimmed('token');
5553 + if (!$token || $token != common_session_token()) {
5554 + $this->client_error(_('There was a problem with your session token. Try again, please.'));
5557 hunk ./actions/newnotice.php 40
5558 - $this->save_new_notice();
5560 - $this->show_form();
5563 + $this->save_new_notice();
5565 + $this->show_form();
5568 hunk ./actions/newnotice.php 46
5569 - function save_new_notice() {
5570 + function save_new_notice() {
5571 hunk ./actions/newnotice.php 48
5572 - $user = common_current_user();
5573 - assert($user); # XXX: maybe an error instead...
5574 - $content = $this->trimmed('status_textarea');
5575 + $user = common_current_user();
5576 + assert($user); # XXX: maybe an error instead...
5577 + $content = $this->trimmed('status_textarea');
5578 hunk ./actions/newnotice.php 52
5580 - $this->show_form(_('No content!'));
5583 - $content_shortened = common_shorten_links($content);
5585 + $this->show_form(_('No content!'));
5588 + $content_shortened = common_shorten_links($content);
5589 hunk ./actions/newnotice.php 58
5590 - if (mb_strlen($content_shortened) > 140) {
5591 - common_debug("Content = '$content_shortened'", __FILE__);
5592 - common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
5593 - $this->show_form(_('That\'s too long. Max notice size is 140 chars.'));
5597 + if (mb_strlen($content_shortened) > 140) {
5598 + common_debug("Content = '$content_shortened'", __FILE__);
5599 + common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
5600 + $this->show_form(_('That\'s too long. Max notice size is 140 chars.'));
5604 hunk ./actions/newnotice.php 66
5605 - $inter = new CommandInterpreter();
5606 + $inter = new CommandInterpreter();
5607 hunk ./actions/newnotice.php 68
5608 - $cmd = $inter->handle_command($user, $content_shortened);
5609 + $cmd = $inter->handle_command($user, $content_shortened);
5610 hunk ./actions/newnotice.php 70
5612 - if ($this->boolean('ajax')) {
5613 - $cmd->execute(new AjaxWebChannel());
5615 - $cmd->execute(new WebChannel());
5620 + if ($this->boolean('ajax')) {
5621 + $cmd->execute(new AjaxWebChannel());
5623 + $cmd->execute(new WebChannel());
5627 hunk ./actions/newnotice.php 79
5628 - $replyto = $this->trimmed('inreplyto');
5629 + $replyto = $this->trimmed('inreplyto');
5630 hunk ./actions/newnotice.php 81
5631 - $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
5632 + $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
5633 hunk ./actions/newnotice.php 83
5634 - if (is_string($notice)) {
5635 - $this->show_form($notice);
5638 + if (is_string($notice)) {
5639 + $this->show_form($notice);
5642 hunk ./actions/newnotice.php 88
5643 - common_broadcast_notice($notice);
5644 + common_broadcast_notice($notice);
5645 hunk ./actions/newnotice.php 90
5646 - if ($this->boolean('ajax')) {
5647 - common_start_html('text/xml;charset=utf-8', true);
5648 - common_element_start('head');
5649 - common_element('title', null, _('Notice posted'));
5650 - common_element_end('head');
5651 - common_element_start('body');
5652 - $this->show_notice($notice);
5653 - common_element_end('body');
5654 - common_element_end('html');
5656 - $returnto = $this->trimmed('returnto');
5657 + if ($this->boolean('ajax')) {
5658 + common_start_html('text/xml;charset=utf-8', true);
5659 + common_element_start('head');
5660 + common_element('title', null, _('Notice posted'));
5661 + common_element_end('head');
5662 + common_element_start('body');
5663 + $this->show_notice($notice);
5664 + common_element_end('body');
5665 + common_element_end('html');
5667 + $returnto = $this->trimmed('returnto');
5668 hunk ./actions/newnotice.php 102
5670 - $url = common_local_url($returnto,
5671 - array('nickname' => $user->nickname));
5673 - $url = common_local_url('shownotice',
5674 - array('notice' => $notice->id));
5676 - common_redirect($url, 303);
5680 + $url = common_local_url($returnto,
5681 + array('nickname' => $user->nickname));
5683 + $url = common_local_url('shownotice',
5684 + array('notice' => $notice->id));
5686 + common_redirect($url, 303);
5689 hunk ./actions/newnotice.php 113
5690 - function ajax_error_msg($msg) {
5691 - common_start_html('text/xml;charset=utf-8', true);
5692 - common_element_start('head');
5693 - common_element('title', null, _('Ajax Error'));
5694 - common_element_end('head');
5695 - common_element_start('body');
5696 - common_element('p', array('id' => 'error'), $msg);
5697 - common_element_end('body');
5698 - common_element_end('html');
5700 + function ajax_error_msg($msg) {
5701 + common_start_html('text/xml;charset=utf-8', true);
5702 + common_element_start('head');
5703 + common_element('title', null, _('Ajax Error'));
5704 + common_element_end('head');
5705 + common_element_start('body');
5706 + common_element('p', array('id' => 'error'), $msg);
5707 + common_element_end('body');
5708 + common_element_end('html');
5710 hunk ./actions/newnotice.php 124
5711 - function show_top($content=NULL) {
5712 - common_notice_form(NULL, $content);
5714 + function show_top($content=NULL) {
5715 + common_notice_form(NULL, $content);
5717 hunk ./actions/newnotice.php 128
5718 - function show_form($msg=NULL) {
5719 - if ($msg && $this->boolean('ajax')) {
5720 - $this->ajax_error_msg($msg);
5723 - $content = $this->trimmed('status_textarea');
5725 - $replyto = $this->trimmed('replyto');
5726 - $profile = Profile::staticGet('nickname', $replyto);
5728 - $content = '@' . $profile->nickname . ' ';
5731 - common_show_header(_('New notice'), NULL, $content,
5732 - array($this, 'show_top'));
5734 - common_element('p', array('id' => 'error'), $msg);
5736 - common_show_footer();
5738 + function show_form($msg=NULL) {
5739 + if ($msg && $this->boolean('ajax')) {
5740 + $this->ajax_error_msg($msg);
5743 + $content = $this->trimmed('status_textarea');
5745 + $replyto = $this->trimmed('replyto');
5746 + $profile = Profile::staticGet('nickname', $replyto);
5748 + $content = '@' . $profile->nickname . ' ';
5751 + common_show_header(_('New notice'), NULL, $content,
5752 + array($this, 'show_top'));
5754 + common_element('p', array('id' => 'error'), $msg);
5756 + common_show_footer();
5758 hunk ./actions/newnotice.php 149
5759 - function show_notice($notice) {
5760 + function show_notice($notice) {
5761 hunk ./actions/newnotice.php 152
5764 hunk ./actions/noticesearch.php 28
5765 - function get_instructions() {
5766 - return _('Search for notices on %%site.name%% by their contents. Separate search terms by spaces; they must be 3 characters or more.');
5768 + function get_instructions() {
5769 + return _('Search for notices on %%site.name%% by their contents. Separate search terms by spaces; they must be 3 characters or more.');
5771 hunk ./actions/noticesearch.php 32
5772 - function get_title() {
5773 - return _('Text search');
5775 + function get_title() {
5776 + return _('Text search');
5778 hunk ./actions/noticesearch.php 36
5779 - function show_results($q, $page) {
5780 + function show_results($q, $page) {
5781 hunk ./actions/noticesearch.php 38
5782 - $notice = new Notice();
5783 + $notice = new Notice();
5784 hunk ./actions/noticesearch.php 40
5785 - # lcase it for comparison
5786 - $q = strtolower($q);
5787 + # lcase it for comparison
5788 + $q = strtolower($q);
5789 hunk ./actions/noticesearch.php 46
5790 - # Ask for an extra to see if there's more.
5791 - $search_engine->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
5792 + # Ask for an extra to see if there's more.
5793 + $search_engine->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
5794 hunk ./actions/noticesearch.php 53
5795 - $cnt = $notice->find();
5796 + $cnt = $notice->find();
5799 + $terms = preg_split('/[\s,]+/', $q);
5800 + common_element_start('ul', array('id' => 'notices'));
5801 + for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
5802 + if ($notice->fetch()) {
5803 + $this->show_notice($notice, $terms);
5805 + // shouldn't happen!
5809 + common_element_end('ul');
5811 + common_element('p', 'error', _('No results'));
5812 hunk ./actions/noticesearch.php 70
5814 - $terms = preg_split('/[\s,]+/', $q);
5815 - common_element_start('ul', array('id' => 'notices'));
5816 - for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
5817 - if ($notice->fetch()) {
5818 - $this->show_notice($notice, $terms);
5820 - // shouldn't happen!
5824 - common_element_end('ul');
5826 - common_element('p', 'error', _('No results'));
5828 hunk ./actions/noticesearch.php 71
5829 - common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
5830 - $page, 'noticesearch', array('q' => $q));
5832 + common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
5833 + $page, 'noticesearch', array('q' => $q));
5835 hunk ./actions/noticesearch.php 75
5836 - function show_header($arr) {
5841 - common_element('link', array('rel' => 'alternate',
5842 - 'href' => common_local_url('noticesearchrss',
5843 - array('q' => $q)),
5844 - 'type' => 'application/rss+xml',
5845 - 'title' => _('Search Stream Feed')));
5848 + function show_header($arr) {
5853 + common_element('link', array('rel' => 'alternate',
5854 + 'href' => common_local_url('noticesearchrss',
5855 + array('q' => $q)),
5856 + 'type' => 'application/rss+xml',
5857 + 'title' => _('Search Stream Feed')));
5860 hunk ./actions/noticesearch.php 88
5861 - # XXX: refactor and combine with StreamAction::show_notice()
5862 + # XXX: refactor and combine with StreamAction::show_notice()
5863 hunk ./actions/noticesearch.php 90
5864 - function show_notice($notice, $terms) {
5865 - $profile = $notice->getProfile();
5867 - common_log_db_error($notice, 'SELECT', __FILE__);
5868 - $this->server_error(_('Notice without matching profile'));
5872 - common_element_start('li', array('class' => 'notice_single',
5873 - 'id' => 'notice-' . $notice->id));
5874 - $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
5875 - common_element_start('a', array('href' => $profile->profileurl));
5876 - common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
5877 - 'class' => 'avatar stream',
5878 - 'width' => AVATAR_STREAM_SIZE,
5879 - 'height' => AVATAR_STREAM_SIZE,
5881 - ($profile->fullname) ? $profile->fullname :
5882 - $profile->nickname));
5883 - common_element_end('a');
5884 - common_element('a', array('href' => $profile->profileurl,
5885 - 'class' => 'nickname'),
5886 - $profile->nickname);
5887 - # FIXME: URL, image, video, audio
5888 - common_element_start('p', array('class' => 'content'));
5889 - if ($notice->rendered) {
5890 - common_raw($this->highlight($notice->rendered, $terms));
5892 - # XXX: may be some uncooked notices in the DB,
5893 - # we cook them right now. This should probably disappear in future
5894 - # versions (>> 0.4.x)
5895 - common_raw($this->highlight(common_render_content($notice->content, $notice), $terms));
5897 - common_element_end('p');
5898 - $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
5899 - common_element_start('p', 'time');
5900 - common_element('a', array('class' => 'permalink',
5901 - 'href' => $noticeurl,
5902 - 'title' => common_exact_date($notice->created)),
5903 - common_date_string($notice->created));
5904 - if ($notice->reply_to) {
5905 - $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
5906 - common_text(' (');
5907 - common_element('a', array('class' => 'inreplyto',
5908 - 'href' => $replyurl),
5909 - _('in reply to...'));
5912 - common_element_start('a',
5913 - array('href' => common_local_url('newnotice',
5914 - array('replyto' => $profile->nickname)),
5915 - 'onclick' => 'doreply("'.$profile->nickname.'"); return false',
5916 - 'title' => _('reply'),
5917 - 'class' => 'replybutton'));
5918 - common_hidden('posttoken', common_session_token());
5920 - common_raw('→');
5921 - common_element_end('a');
5922 - common_element_end('p');
5923 - common_element_end('li');
5925 + function show_notice($notice, $terms) {
5926 + $profile = $notice->getProfile();
5928 + common_log_db_error($notice, 'SELECT', __FILE__);
5929 + $this->server_error(_('Notice without matching profile'));
5933 + common_element_start('li', array('class' => 'notice_single',
5934 + 'id' => 'notice-' . $notice->id));
5935 + $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
5936 + common_element_start('a', array('href' => $profile->profileurl));
5937 + common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
5938 + 'class' => 'avatar stream',
5939 + 'width' => AVATAR_STREAM_SIZE,
5940 + 'height' => AVATAR_STREAM_SIZE,
5942 + ($profile->fullname) ? $profile->fullname :
5943 + $profile->nickname));
5944 + common_element_end('a');
5945 + common_element('a', array('href' => $profile->profileurl,
5946 + 'class' => 'nickname'),
5947 + $profile->nickname);
5948 + # FIXME: URL, image, video, audio
5949 + common_element_start('p', array('class' => 'content'));
5950 + if ($notice->rendered) {
5951 + common_raw($this->highlight($notice->rendered, $terms));
5953 + # XXX: may be some uncooked notices in the DB,
5954 + # we cook them right now. This should probably disappear in future
5955 + # versions (>> 0.4.x)
5956 + common_raw($this->highlight(common_render_content($notice->content, $notice), $terms));
5958 + common_element_end('p');
5959 + $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
5960 + common_element_start('p', 'time');
5961 + common_element('a', array('class' => 'permalink',
5962 + 'href' => $noticeurl,
5963 + 'title' => common_exact_date($notice->created)),
5964 + common_date_string($notice->created));
5965 + if ($notice->reply_to) {
5966 + $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
5967 + common_text(' (');
5968 + common_element('a', array('class' => 'inreplyto',
5969 + 'href' => $replyurl),
5970 + _('in reply to...'));
5973 + common_element_start('a',
5974 + array('href' => common_local_url('newnotice',
5975 + array('replyto' => $profile->nickname)),
5976 + 'onclick' => 'doreply("'.$profile->nickname.'"); return false',
5977 + 'title' => _('reply'),
5978 + 'class' => 'replybutton'));
5979 + common_hidden('posttoken', common_session_token());
5981 + common_raw('→');
5982 + common_element_end('a');
5983 + common_element_end('p');
5984 + common_element_end('li');
5986 hunk ./actions/noticesearch.php 152
5987 - function highlight($text, $terms) {
5988 - /* Highligh serach terms */
5989 - $pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i';
5990 - $result = preg_replace($pattern, '<strong>\\1</strong>', $text);
5991 + function highlight($text, $terms) {
5992 + /* Highligh serach terms */
5993 + $pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i';
5994 + $result = preg_replace($pattern, '<strong>\\1</strong>', $text);
5995 hunk ./actions/noticesearch.php 157
5996 - /* Remove highlighting from inside links, loop incase multiple highlights in links */
5997 - $pattern = '/(href="[^"]*)<strong>('.implode('|',array_map('htmlspecialchars', $terms)).')<\/strong>([^"]*")/iU';
5999 - $result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
6003 + /* Remove highlighting from inside links, loop incase multiple highlights in links */
6004 + $pattern = '/(href="[^"]*)<strong>('.implode('|',array_map('htmlspecialchars', $terms)).')<\/strong>([^"]*")/iU';
6006 + $result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
6010 hunk ./actions/noticesearchrss.php 28
6017 hunk ./actions/noticesearchrss.php 32
6018 - function get_notices($limit=0) {
6019 + function get_notices($limit=0) {
6020 hunk ./actions/noticesearchrss.php 34
6021 - $q = $this->trimmed('q');
6022 - $notices = array();
6023 + $q = $this->trimmed('q');
6024 + $notices = array();
6025 hunk ./actions/noticesearchrss.php 37
6026 - $notice = new Notice();
6027 + $notice = new Notice();
6028 hunk ./actions/noticesearchrss.php 39
6029 - # lcase it for comparison
6030 - $q = strtolower($q);
6031 + # lcase it for comparison
6032 + $q = strtolower($q);
6033 hunk ./actions/noticesearchrss.php 45
6034 - if (!$limit) $limit = 20;
6035 + if (!$limit) $limit = 20;
6036 hunk ./actions/noticesearchrss.php 48
6039 hunk ./actions/noticesearchrss.php 50
6040 - while ($notice->fetch()) {
6041 - $notices[] = clone($notice);
6043 + while ($notice->fetch()) {
6044 + $notices[] = clone($notice);
6046 hunk ./actions/noticesearchrss.php 54
6051 hunk ./actions/noticesearchrss.php 57
6052 - function get_channel() {
6054 - $q = $this->trimmed('q');
6055 - $c = array('url' => common_local_url('noticesearchrss', array('q' => $q)),
6056 - 'title' => $config['site']['name'] . sprintf(_(' Search Stream for "%s"'), $q),
6057 - 'link' => common_local_url('noticesearch', array('q' => $q)),
6058 - 'description' => sprintf(_('All updates matching search term "%s"'), $q));
6061 + function get_channel() {
6063 + $q = $this->trimmed('q');
6064 + $c = array('url' => common_local_url('noticesearchrss', array('q' => $q)),
6065 + 'title' => $config['site']['name'] . sprintf(_(' Search Stream for "%s"'), $q),
6066 + 'link' => common_local_url('noticesearch', array('q' => $q)),
6067 + 'description' => sprintf(_('All updates matching search term "%s"'), $q));
6070 hunk ./actions/noticesearchrss.php 67
6071 - function get_image() {
6074 + function get_image() {
6077 hunk ./actions/nudge.php 26
6078 - function handle($args) {
6079 - parent::handle($args);
6080 + function handle($args) {
6081 + parent::handle($args);
6082 hunk ./actions/nudge.php 29
6083 - if (!common_logged_in()) {
6084 - $this->client_error(_('Not logged in.'));
6087 + if (!common_logged_in()) {
6088 + $this->client_error(_('Not logged in.'));
6091 hunk ./actions/nudge.php 34
6092 - $user = common_current_user();
6093 - $other = User::staticGet('nickname', $this->arg('nickname'));
6094 + $user = common_current_user();
6095 + $other = User::staticGet('nickname', $this->arg('nickname'));
6096 hunk ./actions/nudge.php 37
6097 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
6098 - common_redirect(common_local_url('showstream', array('nickname' => $other->nickname)));
6101 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
6102 + common_redirect(common_local_url('showstream', array('nickname' => $other->nickname)));
6105 hunk ./actions/nudge.php 42
6108 hunk ./actions/nudge.php 44
6109 - $token = $this->trimmed('token');
6111 - if (!$token || $token != common_session_token()) {
6112 - $this->client_error(_('There was a problem with your session token. Try again, please.'));
6115 + $token = $this->trimmed('token');
6117 + if (!$token || $token != common_session_token()) {
6118 + $this->client_error(_('There was a problem with your session token. Try again, please.'));
6121 hunk ./actions/nudge.php 56
6122 - $this->notify($user, $other);
6123 + $this->notify($user, $other);
6124 hunk ./actions/nudge.php 58
6125 - if ($this->boolean('ajax')) {
6126 - common_start_html('text/xml;charset=utf-8', true);
6127 - common_element_start('head');
6128 - common_element('title', null, _('Nudge sent'));
6129 - common_element_end('head');
6130 - common_element_start('body');
6131 - common_nudge_response();
6132 - common_element_end('body');
6133 - common_element_end('html');
6135 + if ($this->boolean('ajax')) {
6136 + common_start_html('text/xml;charset=utf-8', true);
6137 + common_element_start('head');
6138 + common_element('title', null, _('Nudge sent'));
6139 + common_element_end('head');
6140 + common_element_start('body');
6141 + common_nudge_response();
6142 + common_element_end('body');
6143 + common_element_end('html');
6145 hunk ./actions/nudge.php 69
6146 - common_redirect(common_local_url('showstream',
6147 - array('nickname' => $other->nickname)));
6150 + common_redirect(common_local_url('showstream',
6151 + array('nickname' => $other->nickname)));
6154 hunk ./actions/nudge.php 74
6155 - function notify($user, $other) {
6156 - if ($other->id != $user->id) {
6157 - if ($other->email && $other->emailnotifynudge) {
6158 - mail_notify_nudge($user, $other);
6160 - # XXX: notify by IM
6161 - # XXX: notify by SMS
6164 + function notify($user, $other) {
6165 + if ($other->id != $user->id) {
6166 + if ($other->email && $other->emailnotifynudge) {
6167 + mail_notify_nudge($user, $other);
6169 + # XXX: notify by IM
6170 + # XXX: notify by SMS
6173 hunk ./actions/openidlogin.php 26
6174 - function handle($args) {
6175 - parent::handle($args);
6176 - if (common_logged_in()) {
6177 - common_user_error(_('Already logged in.'));
6178 - } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
6179 - $openid_url = $this->trimmed('openid_url');
6180 + function handle($args) {
6181 + parent::handle($args);
6182 + if (common_logged_in()) {
6183 + common_user_error(_('Already logged in.'));
6184 + } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
6185 + $openid_url = $this->trimmed('openid_url');
6186 hunk ./actions/openidlogin.php 33
6188 - $token = $this->trimmed('token');
6189 - if (!$token || $token != common_session_token()) {
6190 - $this->show_form(_('There was a problem with your session token. Try again, please.'), $openid_url);
6194 + $token = $this->trimmed('token');
6195 + if (!$token || $token != common_session_token()) {
6196 + $this->show_form(_('There was a problem with your session token. Try again, please.'), $openid_url);
6199 hunk ./actions/openidlogin.php 40
6200 - $rememberme = $this->boolean('rememberme');
6202 - common_ensure_session();
6204 - $_SESSION['openid_rememberme'] = $rememberme;
6206 - $result = oid_authenticate($openid_url,
6207 - 'finishopenidlogin');
6209 - if (is_string($result)) { # error message
6210 - unset($_SESSION['openid_rememberme']);
6211 - $this->show_form($result, $openid_url);
6214 - $openid_url = oid_get_last();
6215 - $this->show_form(NULL, $openid_url);
6218 + $rememberme = $this->boolean('rememberme');
6220 + common_ensure_session();
6222 + $_SESSION['openid_rememberme'] = $rememberme;
6224 + $result = oid_authenticate($openid_url,
6225 + 'finishopenidlogin');
6227 + if (is_string($result)) { # error message
6228 + unset($_SESSION['openid_rememberme']);
6229 + $this->show_form($result, $openid_url);
6232 + $openid_url = oid_get_last();
6233 + $this->show_form(NULL, $openid_url);
6236 hunk ./actions/openidlogin.php 59
6237 - function get_instructions() {
6238 - return _('Login with an [OpenID](%%doc.openid%%) account.');
6240 + function get_instructions() {
6241 + return _('Login with an [OpenID](%%doc.openid%%) account.');
6243 hunk ./actions/openidlogin.php 63
6244 - function show_top($error=NULL) {
6246 - common_element('div', array('class' => 'error'), $error);
6248 - $instr = $this->get_instructions();
6249 - $output = common_markup_to_html($instr);
6250 - common_element_start('div', 'instructions');
6251 - common_raw($output);
6252 - common_element_end('div');
6255 + function show_top($error=NULL) {
6257 + common_element('div', array('class' => 'error'), $error);
6259 + $instr = $this->get_instructions();
6260 + $output = common_markup_to_html($instr);
6261 + common_element_start('div', 'instructions');
6262 + common_raw($output);
6263 + common_element_end('div');
6266 hunk ./actions/openidlogin.php 75
6267 - function show_form($error=NULL, $openid_url) {
6268 - common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
6269 - $formaction = common_local_url('openidlogin');
6270 - common_element_start('form', array('method' => 'post',
6271 - 'id' => 'openidlogin',
6272 - 'action' => $formaction));
6273 - common_hidden('token', common_session_token());
6274 - common_input('openid_url', _('OpenID URL'),
6276 - _('Your OpenID URL'));
6277 - common_checkbox('rememberme', _('Remember me'), false,
6278 - _('Automatically login in the future; ' .
6279 - 'not for shared computers!'));
6280 - common_submit('submit', _('Login'));
6281 - common_element_end('form');
6282 - common_show_footer();
6284 + function show_form($error=NULL, $openid_url) {
6285 + common_show_header(_('OpenID Login'), NULL, $error, array($this, 'show_top'));
6286 + $formaction = common_local_url('openidlogin');
6287 + common_element_start('form', array('method' => 'post',
6288 + 'id' => 'openidlogin',
6289 + 'action' => $formaction));
6290 + common_hidden('token', common_session_token());
6291 + common_input('openid_url', _('OpenID URL'),
6293 + _('Your OpenID URL'));
6294 + common_checkbox('rememberme', _('Remember me'), false,
6295 + _('Automatically login in the future; ' .
6296 + 'not for shared computers!'));
6297 + common_submit('submit', _('Login'));
6298 + common_element_end('form');
6299 + common_show_footer();
6301 hunk ./actions/openidsettings.php 27
6302 - function get_instructions() {
6303 - return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
6304 - ' with the same user account. '.
6305 - ' Manage your associated OpenIDs from here.');
6307 + function get_instructions() {
6308 + return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
6309 + ' with the same user account. '.
6310 + ' Manage your associated OpenIDs from here.');
6312 hunk ./actions/openidsettings.php 33
6313 - function show_form($msg=NULL, $success=false) {
6314 + function show_form($msg=NULL, $success=false) {
6315 hunk ./actions/openidsettings.php 35
6316 - $user = common_current_user();
6317 + $user = common_current_user();
6318 hunk ./actions/openidsettings.php 37
6319 - $this->form_header(_('OpenID settings'), $msg, $success);
6320 + $this->form_header(_('OpenID settings'), $msg, $success);
6321 hunk ./actions/openidsettings.php 39
6322 - common_element_start('form', array('method' => 'post',
6323 - 'id' => 'openidadd',
6325 - common_local_url('openidsettings')));
6326 - common_hidden('token', common_session_token());
6327 - common_element('h2', NULL, _('Add OpenID'));
6328 - common_element('p', NULL,
6329 - _('If you want to add an OpenID to your account, ' .
6330 - 'enter it in the box below and click "Add".'));
6331 - common_element_start('p');
6332 - common_element('label', array('for' => 'openid_url'),
6334 - common_element('input', array('name' => 'openid_url',
6336 - 'id' => 'openid_url'));
6337 - common_element('input', array('type' => 'submit',
6340 - 'class' => 'submit',
6341 - 'value' => _('Add')));
6342 - common_element_end('p');
6343 - common_element_end('form');
6344 + common_element_start('form', array('method' => 'post',
6345 + 'id' => 'openidadd',
6347 + common_local_url('openidsettings')));
6348 + common_hidden('token', common_session_token());
6349 + common_element('h2', NULL, _('Add OpenID'));
6350 + common_element('p', NULL,
6351 + _('If you want to add an OpenID to your account, ' .
6352 + 'enter it in the box below and click "Add".'));
6353 + common_element_start('p');
6354 + common_element('label', array('for' => 'openid_url'),
6356 + common_element('input', array('name' => 'openid_url',
6358 + 'id' => 'openid_url'));
6359 + common_element('input', array('type' => 'submit',
6362 + 'class' => 'submit',
6363 + 'value' => _('Add')));
6364 + common_element_end('p');
6365 + common_element_end('form');
6366 hunk ./actions/openidsettings.php 62
6367 - $oid = new User_openid();
6368 - $oid->user_id = $user->id;
6369 + $oid = new User_openid();
6370 + $oid->user_id = $user->id;
6371 hunk ./actions/openidsettings.php 65
6372 - $cnt = $oid->find();
6373 + $cnt = $oid->find();
6374 hunk ./actions/openidsettings.php 67
6377 hunk ./actions/openidsettings.php 69
6378 - common_element('h2', NULL, _('Remove OpenID'));
6379 + common_element('h2', NULL, _('Remove OpenID'));
6380 hunk ./actions/openidsettings.php 71
6381 - if ($cnt == 1 && !$user->password) {
6382 + if ($cnt == 1 && !$user->password) {
6383 hunk ./actions/openidsettings.php 73
6384 - common_element('p', NULL,
6385 - _('Removing your only OpenID would make it impossible to log in! ' .
6386 - 'If you need to remove it, add another OpenID first.'));
6387 + common_element('p', NULL,
6388 + _('Removing your only OpenID would make it impossible to log in! ' .
6389 + 'If you need to remove it, add another OpenID first.'));
6390 hunk ./actions/openidsettings.php 77
6391 - if ($oid->fetch()) {
6392 - common_element_start('p');
6393 - common_element('a', array('href' => $oid->canonical),
6395 - common_element_end('p');
6397 + if ($oid->fetch()) {
6398 + common_element_start('p');
6399 + common_element('a', array('href' => $oid->canonical),
6401 + common_element_end('p');
6403 hunk ./actions/openidsettings.php 84
6406 hunk ./actions/openidsettings.php 86
6407 - common_element('p', NULL,
6408 - _('You can remove an OpenID from your account '.
6409 - 'by clicking the button marked "Remove".'));
6411 + common_element('p', NULL,
6412 + _('You can remove an OpenID from your account '.
6413 + 'by clicking the button marked "Remove".'));
6415 hunk ./actions/openidsettings.php 91
6416 - while ($oid->fetch()) {
6417 - common_element_start('form', array('method' => 'POST',
6418 - 'id' => 'openiddelete' . $idx,
6420 - common_local_url('openidsettings')));
6421 - common_element_start('p');
6422 - common_hidden('token', common_session_token());
6423 - common_element('a', array('href' => $oid->canonical),
6425 - common_element('input', array('type' => 'hidden',
6426 - 'id' => 'openid_url'.$idx,
6427 - 'name' => 'openid_url',
6428 - 'value' => $oid->canonical));
6429 - common_element('input', array('type' => 'submit',
6430 - 'id' => 'remove'.$idx,
6431 - 'name' => 'remove',
6432 - 'class' => 'submit',
6433 - 'value' => _('Remove')));
6434 - common_element_end('p');
6435 - common_element_end('form');
6440 + while ($oid->fetch()) {
6441 + common_element_start('form', array('method' => 'POST',
6442 + 'id' => 'openiddelete' . $idx,
6444 + common_local_url('openidsettings')));
6445 + common_element_start('p');
6446 + common_hidden('token', common_session_token());
6447 + common_element('a', array('href' => $oid->canonical),
6449 + common_element('input', array('type' => 'hidden',
6450 + 'id' => 'openid_url'.$idx,
6451 + 'name' => 'openid_url',
6452 + 'value' => $oid->canonical));
6453 + common_element('input', array('type' => 'submit',
6454 + 'id' => 'remove'.$idx,
6455 + 'name' => 'remove',
6456 + 'class' => 'submit',
6457 + 'value' => _('Remove')));
6458 + common_element_end('p');
6459 + common_element_end('form');
6464 hunk ./actions/openidsettings.php 116
6465 - common_show_footer();
6467 + common_show_footer();
6469 hunk ./actions/openidsettings.php 119
6470 - function handle_post() {
6472 - $token = $this->trimmed('token');
6473 - if (!$token || $token != common_session_token()) {
6474 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
6477 + function handle_post() {
6479 + $token = $this->trimmed('token');
6480 + if (!$token || $token != common_session_token()) {
6481 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
6484 hunk ./actions/openidsettings.php 127
6485 - if ($this->arg('add')) {
6486 - $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid');
6487 - if (is_string($result)) { # error message
6488 - $this->show_form($result);
6490 - } else if ($this->arg('remove')) {
6491 - $this->remove_openid();
6493 - $this->show_form(_('Something weird happened.'));
6496 + if ($this->arg('add')) {
6497 + $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid');
6498 + if (is_string($result)) { # error message
6499 + $this->show_form($result);
6501 + } else if ($this->arg('remove')) {
6502 + $this->remove_openid();
6504 + $this->show_form(_('Something weird happened.'));
6507 hunk ./actions/openidsettings.php 139
6508 - function remove_openid() {
6509 + function remove_openid() {
6510 hunk ./actions/openidsettings.php 141
6511 - $openid_url = $this->trimmed('openid_url');
6512 - $oid = User_openid::staticGet('canonical', $openid_url);
6514 - $this->show_form(_('No such OpenID.'));
6517 - $cur = common_current_user();
6518 - if (!$cur || $oid->user_id != $cur->id) {
6519 - $this->show_form(_('That OpenID does not belong to you.'));
6523 - $this->show_form(_('OpenID removed.'), true);
6526 + $openid_url = $this->trimmed('openid_url');
6527 + $oid = User_openid::staticGet('canonical', $openid_url);
6529 + $this->show_form(_('No such OpenID.'));
6532 + $cur = common_current_user();
6533 + if (!$cur || $oid->user_id != $cur->id) {
6534 + $this->show_form(_('That OpenID does not belong to you.'));
6538 + $this->show_form(_('OpenID removed.'), true);
6541 hunk ./actions/opensearch.php 24
6542 - function handle($args) {
6543 + function handle($args) {
6544 hunk ./actions/opensearch.php 26
6545 - parent::handle($args);
6546 + parent::handle($args);
6547 hunk ./actions/opensearch.php 28
6548 - $type = $this->trimmed('type');
6549 + $type = $this->trimmed('type');
6550 hunk ./actions/opensearch.php 30
6552 - if ($type == 'people') {
6553 - $type = 'peoplesearch';
6554 - $short_name = _('People Search');
6556 - $short_name = _('Notice Search');
6557 - $type = 'noticesearch';
6560 + if ($type == 'people') {
6561 + $type = 'peoplesearch';
6562 + $short_name = _('People Search');
6564 + $short_name = _('Notice Search');
6565 + $type = 'noticesearch';
6567 hunk ./actions/opensearch.php 39
6568 - header('Content-Type: text/html');
6569 + header('Content-Type: text/html');
6570 hunk ./actions/opensearch.php 41
6571 - common_start_xml();
6572 - common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
6573 + common_start_xml();
6574 + common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
6575 hunk ./actions/opensearch.php 44
6576 - $short_name = common_config('site', 'name').' '.$short_name;
6577 - common_element('ShortName', NULL, $short_name);
6578 - common_element('Contact', NULL, common_config('site', 'email'));
6579 - common_element('Url', array('type' => 'text/html', 'method' => 'get',
6580 - 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
6581 - common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
6582 - common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
6583 - common_element('AdultContent', NULL, 'false');
6584 - common_element('Language', NULL, common_language());
6585 - common_element('OutputEncoding', NULL, 'UTF-8');
6586 - common_element('InputEncoding', NULL, 'UTF-8');
6587 + $short_name = common_config('site', 'name').' '.$short_name;
6588 + common_element('ShortName', NULL, $short_name);
6589 + common_element('Contact', NULL, common_config('site', 'email'));
6590 + common_element('Url', array('type' => 'text/html', 'method' => 'get',
6591 + 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
6592 + common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
6593 + common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
6594 + common_element('AdultContent', NULL, 'false');
6595 + common_element('Language', NULL, common_language());
6596 + common_element('OutputEncoding', NULL, 'UTF-8');
6597 + common_element('InputEncoding', NULL, 'UTF-8');
6598 hunk ./actions/opensearch.php 56
6599 - common_element_end('OpenSearchDescription');
6602 + common_element_end('OpenSearchDescription');
6605 hunk ./actions/othersettings.php 26
6606 - function get_instructions() {
6607 - return _('Manage various other options.');
6609 + function get_instructions() {
6610 + return _('Manage various other options.');
6612 hunk ./actions/othersettings.php 30
6613 - function show_form($msg=NULL, $success=false) {
6614 - $user = common_current_user();
6615 + function show_form($msg=NULL, $success=false) {
6616 + $user = common_current_user();
6617 hunk ./actions/othersettings.php 33
6618 - $this->form_header(_('Other Settings'), $msg, $success);
6619 + $this->form_header(_('Other Settings'), $msg, $success);
6620 hunk ./actions/othersettings.php 35
6621 - common_element('h2', NULL, _('URL Auto-shortening'));
6622 - common_element_start('form', array('method' => 'post',
6623 - 'id' => 'othersettings',
6625 - common_local_url('othersettings')));
6626 - common_hidden('token', common_session_token());
6627 + common_element('h2', NULL, _('URL Auto-shortening'));
6628 + common_element_start('form', array('method' => 'post',
6629 + 'id' => 'othersettings',
6631 + common_local_url('othersettings')));
6632 + common_hidden('token', common_session_token());
6633 hunk ./actions/othersettings.php 42
6634 - $services = array(
6636 + $services = array(
6638 hunk ./actions/othersettings.php 48
6639 - 'tinyurl.com' => 'tinyurl.com',
6640 - 'is.gd' => 'is.gd',
6641 - 'snipr.com' => 'snipr.com',
6642 - 'metamark.net' => 'metamark.net'
6644 + 'tinyurl.com' => 'tinyurl.com',
6645 + 'is.gd' => 'is.gd',
6646 + 'snipr.com' => 'snipr.com',
6647 + 'metamark.net' => 'metamark.net'
6649 hunk ./actions/othersettings.php 54
6650 - common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), FALSE, $user->urlshorteningservice);
6651 + common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), FALSE, $user->urlshorteningservice);
6652 hunk ./actions/othersettings.php 56
6653 - common_submit('save', _('Save'));
6654 + common_submit('save', _('Save'));
6655 hunk ./actions/othersettings.php 58
6656 - common_element_end('form');
6657 + common_element_end('form');
6658 hunk ./actions/othersettings.php 60
6659 -// common_element('h2', NULL, _('Delete my account'));
6660 -// $this->show_delete_form();
6661 +// common_element('h2', NULL, _('Delete my account'));
6662 +// $this->show_delete_form();
6663 hunk ./actions/othersettings.php 63
6664 - common_show_footer();
6666 + common_show_footer();
6668 hunk ./actions/othersettings.php 66
6669 - function show_feeds_list($feeds) {
6670 - common_element_start('div', array('class' => 'feedsdel'));
6671 - common_element('p', null, 'Feeds:');
6672 - common_element_start('ul', array('class' => 'xoxo'));
6673 + function show_feeds_list($feeds) {
6674 + common_element_start('div', array('class' => 'feedsdel'));
6675 + common_element('p', null, 'Feeds:');
6676 + common_element_start('ul', array('class' => 'xoxo'));
6677 hunk ./actions/othersettings.php 71
6678 - foreach ($feeds as $key => $value) {
6679 - $this->common_feed_item($feeds[$key]);
6681 - common_element_end('ul');
6682 - common_element_end('div');
6684 + foreach ($feeds as $key => $value) {
6685 + $this->common_feed_item($feeds[$key]);
6687 + common_element_end('ul');
6688 + common_element_end('div');
6690 hunk ./actions/othersettings.php 79
6691 - function common_feed_item($feed) {
6692 + function common_feed_item($feed) {
6693 hunk ./actions/othersettings.php 81
6694 - $nickname = $user->nickname;
6695 + $nickname = $user->nickname;
6696 hunk ./actions/othersettings.php 83
6697 - switch($feed['item']) {
6698 - case 'notices': default:
6699 - $feed_classname = $feed['type'];
6700 - $feed_mimetype = "application/".$feed['type']."+xml";
6701 - $feed_title = "$nickname's ".$feed['version']." notice feed";
6702 - $feed['textContent'] = "RSS";
6704 + switch($feed['item']) {
6705 + case 'notices': default:
6706 + $feed_classname = $feed['type'];
6707 + $feed_mimetype = "application/".$feed['type']."+xml";
6708 + $feed_title = "$nickname's ".$feed['version']." notice feed";
6709 + $feed['textContent'] = "RSS";
6711 hunk ./actions/othersettings.php 91
6713 - $feed_classname = "foaf";
6714 - $feed_mimetype = "application/".$feed['type']."+xml";
6715 - $feed_title = "$nickname's FOAF file";
6716 - $feed['textContent'] = "FOAF";
6719 - common_element_start('li');
6720 - common_element('a', array('href' => $feed['href'],
6721 - 'class' => $feed_classname,
6722 - 'type' => $feed_mimetype,
6723 - 'title' => $feed_title),
6724 - $feed['textContent']);
6725 - common_element_end('li');
6728 + $feed_classname = "foaf";
6729 + $feed_mimetype = "application/".$feed['type']."+xml";
6730 + $feed_title = "$nickname's FOAF file";
6731 + $feed['textContent'] = "FOAF";
6734 + common_element_start('li');
6735 + common_element('a', array('href' => $feed['href'],
6736 + 'class' => $feed_classname,
6737 + 'type' => $feed_mimetype,
6738 + 'title' => $feed_title),
6739 + $feed['textContent']);
6740 + common_element_end('li');
6742 hunk ./actions/othersettings.php 107
6743 -// function show_delete_form() {
6744 -// $user = common_current_user();
6745 +// function show_delete_form() {
6746 +// $user = common_current_user();
6747 hunk ./actions/othersettings.php 113
6748 -// common_element_start('form', array('method' => 'POST',
6749 -// 'id' => 'delete',
6751 -// common_local_url('deleteprofile')));
6752 +// common_element_start('form', array('method' => 'POST',
6753 +// 'id' => 'delete',
6755 +// common_local_url('deleteprofile')));
6756 hunk ./actions/othersettings.php 118
6757 -// common_hidden('token', common_session_token());
6758 +// common_hidden('token', common_session_token());
6759 hunk ./actions/othersettings.php 121
6760 -// $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
6761 -// 'type' => 'rss',
6762 -// 'version' => 'RSS 1.0',
6763 -// 'item' => 'notices'),
6764 -// 1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
6765 -// 'type' => 'rdf',
6766 -// 'version' => 'FOAF',
6767 -// 'item' => 'foaf')));
6768 +// $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
6769 +// 'type' => 'rss',
6770 +// 'version' => 'RSS 1.0',
6771 +// 'item' => 'notices'),
6772 +// 1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
6773 +// 'type' => 'rdf',
6774 +// 'version' => 'FOAF',
6775 +// 'item' => 'foaf')));
6776 hunk ./actions/othersettings.php 130
6777 -// common_submit('deleteaccount', _('Delete my account'));
6778 -// common_element_end('form');
6780 +// common_submit('deleteaccount', _('Delete my account'));
6781 +// common_element_end('form');
6783 hunk ./actions/othersettings.php 134
6784 - function handle_post() {
6785 + function handle_post() {
6786 hunk ./actions/othersettings.php 136
6788 - $token = $this->trimmed('token');
6789 - if (!$token || $token != common_session_token()) {
6790 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
6794 + $token = $this->trimmed('token');
6795 + if (!$token || $token != common_session_token()) {
6796 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
6799 hunk ./actions/othersettings.php 143
6800 - if ($this->arg('save')) {
6801 - $this->save_preferences();
6803 - $this->show_form(_('Unexpected form submission.'));
6806 + if ($this->arg('save')) {
6807 + $this->save_preferences();
6809 + $this->show_form(_('Unexpected form submission.'));
6812 hunk ./actions/othersettings.php 150
6813 - function save_preferences() {
6814 + function save_preferences() {
6815 hunk ./actions/othersettings.php 152
6816 - $urlshorteningservice = $this->trimmed('urlshorteningservice');
6817 + $urlshorteningservice = $this->trimmed('urlshorteningservice');
6818 hunk ./actions/othersettings.php 154
6819 - if (!is_null($urlshorteningservice) && strlen($urlshorteningservice) > 50) {
6820 - $this->show_form(_('URL shortening service is too long (max 50 chars).'));
6823 + if (!is_null($urlshorteningservice) && strlen($urlshorteningservice) > 50) {
6824 + $this->show_form(_('URL shortening service is too long (max 50 chars).'));
6827 hunk ./actions/othersettings.php 159
6828 - $user = common_current_user();
6829 + $user = common_current_user();
6830 hunk ./actions/othersettings.php 161
6831 - assert(!is_null($user)); # should already be checked
6832 + assert(!is_null($user)); # should already be checked
6833 hunk ./actions/othersettings.php 163
6834 - $user->query('BEGIN');
6835 + $user->query('BEGIN');
6836 hunk ./actions/othersettings.php 165
6837 - $original = clone($user);
6838 + $original = clone($user);
6839 hunk ./actions/othersettings.php 167
6840 - $user->urlshorteningservice = $urlshorteningservice;
6841 + $user->urlshorteningservice = $urlshorteningservice;
6842 hunk ./actions/othersettings.php 169
6843 - $result = $user->update($original);
6844 + $result = $user->update($original);
6845 hunk ./actions/othersettings.php 171
6846 - if ($result === FALSE) {
6847 - common_log_db_error($user, 'UPDATE', __FILE__);
6848 - common_server_error(_('Couldn\'t update user.'));
6851 + if ($result === FALSE) {
6852 + common_log_db_error($user, 'UPDATE', __FILE__);
6853 + common_server_error(_('Couldn\'t update user.'));
6856 hunk ./actions/othersettings.php 177
6857 - $user->query('COMMIT');
6858 + $user->query('COMMIT');
6859 hunk ./actions/othersettings.php 179
6860 - $this->show_form(_('Preferences saved.'), true);
6862 + $this->show_form(_('Preferences saved.'), true);
6864 hunk ./actions/peoplesearch.php 27
6865 - function get_instructions() {
6866 - return _('Search for people on %%site.name%% by their name, location, or interests. ' .
6867 - 'Separate the terms by spaces; they must be 3 characters or more.');
6869 + function get_instructions() {
6870 + return _('Search for people on %%site.name%% by their name, location, or interests. ' .
6871 + 'Separate the terms by spaces; they must be 3 characters or more.');
6873 hunk ./actions/peoplesearch.php 32
6874 - function get_title() {
6875 - return _('People search');
6877 + function get_title() {
6878 + return _('People search');
6880 hunk ./actions/peoplesearch.php 36
6881 - function show_results($q, $page) {
6882 + function show_results($q, $page) {
6883 hunk ./actions/peoplesearch.php 38
6884 - $profile = new Profile();
6885 + $profile = new Profile();
6886 hunk ./actions/peoplesearch.php 40
6887 - # lcase it for comparison
6888 - $q = strtolower($q);
6889 + # lcase it for comparison
6890 + $q = strtolower($q);
6891 hunk ./actions/peoplesearch.php 46
6892 - # Ask for an extra to see if there's more.
6893 + # Ask for an extra to see if there's more.
6894 hunk ./actions/peoplesearch.php 52
6895 - $cnt = $profile->find();
6896 + $cnt = $profile->find();
6899 + $terms = preg_split('/[\s,]+/', $q);
6900 + $results = new PeopleSearchResults($profile, $terms);
6901 + $results->show_list();
6903 + common_element('p', 'error', _('No results'));
6904 hunk ./actions/peoplesearch.php 61
6906 - $terms = preg_split('/[\s,]+/', $q);
6907 - $results = new PeopleSearchResults($profile, $terms);
6908 - $results->show_list();
6910 - common_element('p', 'error', _('No results'));
6912 hunk ./actions/peoplesearch.php 62
6915 - common_pagination($page > 1, $cnt > PROFILES_PER_PAGE,
6916 - $page, 'peoplesearch', array('q' => $q));
6920 + common_pagination($page > 1, $cnt > PROFILES_PER_PAGE,
6921 + $page, 'peoplesearch', array('q' => $q));
6923 hunk ./actions/peoplesearch.php 71
6924 - var $terms = NULL;
6925 - var $pattern = NULL;
6927 - function __construct($profile, $terms) {
6928 - parent::__construct($profile);
6929 - $this->terms = array_map('preg_quote',
6930 - array_map('htmlspecialchars', $terms));
6931 - $this->pattern = '/('.implode('|',$terms).')/i';
6934 - function highlight($text) {
6935 - return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
6937 + var $terms = NULL;
6938 + var $pattern = NULL;
6940 + function __construct($profile, $terms) {
6941 + parent::__construct($profile);
6942 + $this->terms = array_map('preg_quote',
6943 + array_map('htmlspecialchars', $terms));
6944 + $this->pattern = '/('.implode('|',$terms).')/i';
6947 + function highlight($text) {
6948 + return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
6950 hunk ./actions/peopletag.php 25
6952 - function handle($args) {
6954 + function handle($args) {
6955 hunk ./actions/peopletag.php 28
6956 - parent::handle($args);
6957 + parent::handle($args);
6958 hunk ./actions/peopletag.php 30
6959 - $tag = $this->trimmed('tag');
6961 - if (!common_valid_profile_tag($tag)) {
6962 - $this->client_error(sprintf(_('Not a valid people tag: %s'), $tag));
6965 + $tag = $this->trimmed('tag');
6967 + if (!common_valid_profile_tag($tag)) {
6968 + $this->client_error(sprintf(_('Not a valid people tag: %s'), $tag));
6971 hunk ./actions/peopletag.php 37
6972 - $page = $this->trimmed('page');
6978 - # Looks like we're good; show the header
6979 + $page = $this->trimmed('page');
6985 + # Looks like we're good; show the header
6986 hunk ./actions/peopletag.php 45
6987 - common_show_header(sprintf(_('Users self-tagged with %s - page %d'), $tag, $page),
6988 - NULL, $tag, array($this, 'show_top'));
6989 + common_show_header(sprintf(_('Users self-tagged with %s - page %d'), $tag, $page),
6990 + NULL, $tag, array($this, 'show_top'));
6991 hunk ./actions/peopletag.php 48
6992 - $this->show_people($tag, $page);
6993 + $this->show_people($tag, $page);
6994 hunk ./actions/peopletag.php 50
6995 - common_show_footer();
6997 + common_show_footer();
6999 hunk ./actions/peopletag.php 53
7000 - function show_people($tag, $page) {
7002 - $profile = new Profile();
7003 + function show_people($tag, $page) {
7005 + $profile = new Profile();
7006 hunk ./actions/peopletag.php 57
7007 - $offset = ($page-1)*PROFILES_PER_PAGE;
7008 - $limit = PROFILES_PER_PAGE + 1;
7010 - if (common_config('db','type') == 'pgsql') {
7011 - $lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset;
7013 - $lim = ' LIMIT ' . $offset . ', ' . $limit;
7015 + $offset = ($page-1)*PROFILES_PER_PAGE;
7016 + $limit = PROFILES_PER_PAGE + 1;
7018 + if (common_config('db','type') == 'pgsql') {
7019 + $lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset;
7021 + $lim = ' LIMIT ' . $offset . ', ' . $limit;
7023 hunk ./actions/peopletag.php 66
7024 - # XXX: memcached this
7026 - $profile->query(sprintf('SELECT profile.* ' .
7027 - 'FROM profile JOIN profile_tag ' .
7028 - 'ON profile.id = profile_tag.tagger ' .
7029 - 'WHERE profile_tag.tagger = profile_tag.tagged ' .
7030 - 'AND tag = "%s" ' .
7031 - 'ORDER BY profile_tag.modified DESC ' .
7033 + # XXX: memcached this
7035 + $profile->query(sprintf('SELECT profile.* ' .
7036 + 'FROM profile JOIN profile_tag ' .
7037 + 'ON profile.id = profile_tag.tagger ' .
7038 + 'WHERE profile_tag.tagger = profile_tag.tagged ' .
7039 + 'AND tag = "%s" ' .
7040 + 'ORDER BY profile_tag.modified DESC ' .
7042 hunk ./actions/peopletag.php 76
7043 - $pl = new ProfileList($profile);
7044 - $cnt = $pl->show_list();
7046 - common_pagination($page > 1,
7047 - $cnt > PROFILES_PER_PAGE,
7049 - $this->trimmed('action'),
7050 - array('tag' => $tag));
7053 - function show_top($tag) {
7054 - $instr = sprintf(_('These are users who have tagged themselves "%s" ' .
7055 - 'to show a common interest, characteristic, hobby or job.'), $tag);
7056 - common_element_start('div', 'instructions');
7057 - common_element_start('p');
7058 - common_text($instr);
7059 - common_element_end('p');
7060 - common_element_end('div');
7062 + $pl = new ProfileList($profile);
7063 + $cnt = $pl->show_list();
7065 + common_pagination($page > 1,
7066 + $cnt > PROFILES_PER_PAGE,
7068 + $this->trimmed('action'),
7069 + array('tag' => $tag));
7072 + function show_top($tag) {
7073 + $instr = sprintf(_('These are users who have tagged themselves "%s" ' .
7074 + 'to show a common interest, characteristic, hobby or job.'), $tag);
7075 + common_element_start('div', 'instructions');
7076 + common_element_start('p');
7077 + common_text($instr);
7078 + common_element_end('p');
7079 + common_element_end('div');
7081 hunk ./actions/peopletag.php 96
7082 - function get_title() {
7085 + function get_title() {
7088 hunk ./actions/peopletag.php 100
7089 - function show_header($arr) {
7092 + function show_header($arr) {
7095 hunk ./actions/postnotice.php 25
7096 - function handle($args) {
7097 - parent::handle($args);
7099 - common_remove_magic_from_request();
7100 - $req = OAuthRequest::from_request();
7101 - # Note: server-to-server function!
7102 - $server = omb_oauth_server();
7103 - list($consumer, $token) = $server->verify_request($req);
7104 - if ($this->save_notice($req, $consumer, $token)) {
7105 - print "omb_version=".OMB_VERSION_01;
7107 - } catch (OAuthException $e) {
7108 - common_server_error($e->getMessage());
7112 + function handle($args) {
7113 + parent::handle($args);
7115 + common_remove_magic_from_request();
7116 + $req = OAuthRequest::from_request();
7117 + # Note: server-to-server function!
7118 + $server = omb_oauth_server();
7119 + list($consumer, $token) = $server->verify_request($req);
7120 + if ($this->save_notice($req, $consumer, $token)) {
7121 + print "omb_version=".OMB_VERSION_01;
7123 + } catch (OAuthException $e) {
7124 + common_server_error($e->getMessage());
7128 hunk ./actions/postnotice.php 42
7129 - function save_notice(&$req, &$consumer, &$token) {
7130 - $version = $req->get_parameter('omb_version');
7131 - if ($version != OMB_VERSION_01) {
7132 - common_user_error(_('Unsupported OMB version'), 400);
7135 - # First, check to see
7136 - $listenee = $req->get_parameter('omb_listenee');
7137 - $remote_profile = Remote_profile::staticGet('uri', $listenee);
7138 - if (!$remote_profile) {
7139 - common_user_error(_('Profile unknown'), 403);
7142 - $sub = Subscription::staticGet('token', $token->key);
7144 - common_user_error(_('No such subscription'), 403);
7147 - $content = $req->get_parameter('omb_notice_content');
7148 + function save_notice(&$req, &$consumer, &$token) {
7149 + $version = $req->get_parameter('omb_version');
7150 + if ($version != OMB_VERSION_01) {
7151 + common_user_error(_('Unsupported OMB version'), 400);
7154 + # First, check to see
7155 + $listenee = $req->get_parameter('omb_listenee');
7156 + $remote_profile = Remote_profile::staticGet('uri', $listenee);
7157 + if (!$remote_profile) {
7158 + common_user_error(_('Profile unknown'), 403);
7161 + $sub = Subscription::staticGet('token', $token->key);
7163 + common_user_error(_('No such subscription'), 403);
7166 + $content = $req->get_parameter('omb_notice_content');
7167 hunk ./actions/postnotice.php 66
7168 - $notice_uri = $req->get_parameter('omb_notice');
7169 - if (!Validate::uri($notice_uri) &&
7170 - !common_valid_tag($notice_uri)) {
7171 - common_user_error(_('Invalid notice uri'), 400);
7174 - $notice_url = $req->get_parameter('omb_notice_url');
7175 - if ($notice_url && !common_valid_http_url($notice_url)) {
7176 - common_user_error(_('Invalid notice url'), 400);
7179 - $notice = Notice::staticGet('uri', $notice_uri);
7181 - $notice = Notice::saveNew($remote_profile->id, $content, 'omb', false, 0, $notice_uri);
7182 - if (is_string($notice)) {
7183 - common_server_serror($notice, 500);
7186 - common_broadcast_notice($notice, true);
7190 + $notice_uri = $req->get_parameter('omb_notice');
7191 + if (!Validate::uri($notice_uri) &&
7192 + !common_valid_tag($notice_uri)) {
7193 + common_user_error(_('Invalid notice uri'), 400);
7196 + $notice_url = $req->get_parameter('omb_notice_url');
7197 + if ($notice_url && !common_valid_http_url($notice_url)) {
7198 + common_user_error(_('Invalid notice url'), 400);
7201 + $notice = Notice::staticGet('uri', $notice_uri);
7203 + $notice = Notice::saveNew($remote_profile->id, $content, 'omb', false, 0, $notice_uri);
7204 + if (is_string($notice)) {
7205 + common_server_serror($notice, 500);
7208 + common_broadcast_notice($notice, true);
7212 hunk ./actions/profilesettings.php 26
7213 - function get_instructions() {
7214 - return _('You can update your personal profile info here '.
7215 - 'so people know more about you.');
7217 + function get_instructions() {
7218 + return _('You can update your personal profile info here '.
7219 + 'so people know more about you.');
7221 hunk ./actions/profilesettings.php 31
7222 - function show_form($msg=NULL, $success=false) {
7223 - $this->form_header(_('Profile settings'), $msg, $success);
7224 - $this->show_settings_form();
7225 - common_element('h2', NULL, _('Avatar'));
7226 - $this->show_avatar_form();
7227 - common_element('h2', NULL, _('Change password'));
7228 - $this->show_password_form();
7229 -// common_element('h2', NULL, _('Delete my account'));
7230 -// $this->show_delete_form();
7231 - common_show_footer();
7233 + function show_form($msg=NULL, $success=false) {
7234 + $this->form_header(_('Profile settings'), $msg, $success);
7235 + $this->show_settings_form();
7236 + common_element('h2', NULL, _('Avatar'));
7237 + $this->show_avatar_form();
7238 + common_element('h2', NULL, _('Change password'));
7239 + $this->show_password_form();
7240 +// common_element('h2', NULL, _('Delete my account'));
7241 +// $this->show_delete_form();
7242 + common_show_footer();
7244 hunk ./actions/profilesettings.php 43
7245 - function handle_post() {
7246 + function handle_post() {
7247 hunk ./actions/profilesettings.php 45
7250 hunk ./actions/profilesettings.php 47
7251 - $token = $this->trimmed('token');
7252 - if (!$token || $token != common_session_token()) {
7253 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
7256 + $token = $this->trimmed('token');
7257 + if (!$token || $token != common_session_token()) {
7258 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
7261 hunk ./actions/profilesettings.php 53
7262 - if ($this->arg('save')) {
7263 - $this->save_profile();
7264 - } else if ($this->arg('upload')) {
7265 - $this->upload_avatar();
7266 - } else if ($this->arg('changepass')) {
7267 - $this->change_password();
7269 + if ($this->arg('save')) {
7270 + $this->save_profile();
7271 + } else if ($this->arg('upload')) {
7272 + $this->upload_avatar();
7273 + } else if ($this->arg('changepass')) {
7274 + $this->change_password();
7276 hunk ./actions/profilesettings.php 61
7279 hunk ./actions/profilesettings.php 63
7280 - function show_settings_form() {
7281 + function show_settings_form() {
7282 hunk ./actions/profilesettings.php 65
7283 - $user = common_current_user();
7284 - $profile = $user->getProfile();
7285 + $user = common_current_user();
7286 + $profile = $user->getProfile();
7287 hunk ./actions/profilesettings.php 68
7288 - common_element_start('form', array('method' => 'POST',
7289 - 'id' => 'profilesettings',
7291 - common_local_url('profilesettings')));
7292 - common_hidden('token', common_session_token());
7294 - # too much common patterns here... abstractable?
7296 - common_input('nickname', _('Nickname'),
7297 - ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
7298 - _('1-64 lowercase letters or numbers, no punctuation or spaces'));
7299 - common_input('fullname', _('Full name'),
7300 - ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
7301 - common_input('homepage', _('Homepage'),
7302 - ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
7303 - _('URL of your homepage, blog, or profile on another site'));
7304 - common_textarea('bio', _('Bio'),
7305 - ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
7306 - _('Describe yourself and your interests in 140 chars'));
7307 - common_input('location', _('Location'),
7308 - ($this->arg('location')) ? $this->arg('location') : $profile->location,
7309 - _('Where you are, like "City, State (or Region), Country"'));
7310 - common_input('tags', _('Tags'),
7311 - ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
7312 - _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
7313 + common_element_start('form', array('method' => 'POST',
7314 + 'id' => 'profilesettings',
7316 + common_local_url('profilesettings')));
7317 + common_hidden('token', common_session_token());
7319 + # too much common patterns here... abstractable?
7321 + common_input('nickname', _('Nickname'),
7322 + ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
7323 + _('1-64 lowercase letters or numbers, no punctuation or spaces'));
7324 + common_input('fullname', _('Full name'),
7325 + ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
7326 + common_input('homepage', _('Homepage'),
7327 + ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
7328 + _('URL of your homepage, blog, or profile on another site'));
7329 + common_textarea('bio', _('Bio'),
7330 + ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
7331 + _('Describe yourself and your interests in 140 chars'));
7332 + common_input('location', _('Location'),
7333 + ($this->arg('location')) ? $this->arg('location') : $profile->location,
7334 + _('Where you are, like "City, State (or Region), Country"'));
7335 + common_input('tags', _('Tags'),
7336 + ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
7337 + _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
7338 hunk ./actions/profilesettings.php 94
7339 - $language = common_language();
7340 - common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), TRUE, $language);
7341 - $timezone = common_timezone();
7342 - $timezones = array();
7343 - foreach(DateTimeZone::listIdentifiers() as $k => $v) {
7344 - $timezones[$v] = $v;
7346 - common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), TRUE, $timezone);
7347 + $language = common_language();
7348 + common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), TRUE, $language);
7349 + $timezone = common_timezone();
7350 + $timezones = array();
7351 + foreach(DateTimeZone::listIdentifiers() as $k => $v) {
7352 + $timezones[$v] = $v;
7354 + common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), TRUE, $timezone);
7355 hunk ./actions/profilesettings.php 103
7356 - common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
7357 - ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
7358 + common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
7359 + ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
7360 hunk ./actions/profilesettings.php 106
7361 - common_submit('save', _('Save'));
7362 + common_submit('save', _('Save'));
7363 hunk ./actions/profilesettings.php 108
7364 - common_element_end('form');
7365 + common_element_end('form');
7366 hunk ./actions/profilesettings.php 111
7369 hunk ./actions/profilesettings.php 113
7370 - function show_avatar_form() {
7371 + function show_avatar_form() {
7372 hunk ./actions/profilesettings.php 115
7373 - $user = common_current_user();
7374 - $profile = $user->getProfile();
7375 + $user = common_current_user();
7376 + $profile = $user->getProfile();
7377 hunk ./actions/profilesettings.php 118
7379 - common_log_db_error($user, 'SELECT', __FILE__);
7380 - $this->server_error(_('User without matching profile'));
7384 - $original = $profile->getOriginalAvatar();
7386 + common_log_db_error($user, 'SELECT', __FILE__);
7387 + $this->server_error(_('User without matching profile'));
7391 + $original = $profile->getOriginalAvatar();
7392 hunk ./actions/profilesettings.php 127
7393 - common_element_start('form', array('enctype' => 'multipart/form-data',
7394 - 'method' => 'POST',
7397 - common_local_url('profilesettings')));
7398 - common_hidden('token', common_session_token());
7399 + common_element_start('form', array('enctype' => 'multipart/form-data',
7400 + 'method' => 'POST',
7403 + common_local_url('profilesettings')));
7404 + common_hidden('token', common_session_token());
7405 hunk ./actions/profilesettings.php 134
7407 - common_element('img', array('src' => $original->url,
7408 - 'class' => 'avatar original',
7409 - 'width' => $original->width,
7410 - 'height' => $original->height,
7411 - 'alt' => $user->nickname));
7414 + common_element('img', array('src' => $original->url,
7415 + 'class' => 'avatar original',
7416 + 'width' => $original->width,
7417 + 'height' => $original->height,
7418 + 'alt' => $user->nickname));
7420 hunk ./actions/profilesettings.php 142
7421 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
7422 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
7423 hunk ./actions/profilesettings.php 144
7425 - common_element('img', array('src' => $avatar->url,
7426 - 'class' => 'avatar profile',
7427 - 'width' => AVATAR_PROFILE_SIZE,
7428 - 'height' => AVATAR_PROFILE_SIZE,
7429 - 'alt' => $user->nickname));
7432 + common_element('img', array('src' => $avatar->url,
7433 + 'class' => 'avatar profile',
7434 + 'width' => AVATAR_PROFILE_SIZE,
7435 + 'height' => AVATAR_PROFILE_SIZE,
7436 + 'alt' => $user->nickname));
7438 hunk ./actions/profilesettings.php 153
7439 - common_element('input', array('name' => 'MAX_FILE_SIZE',
7440 - 'type' => 'hidden',
7441 - 'id' => 'MAX_FILE_SIZE',
7442 - 'value' => MAX_AVATAR_SIZE));
7443 + common_element('input', array('name' => 'MAX_FILE_SIZE',
7444 + 'type' => 'hidden',
7445 + 'id' => 'MAX_FILE_SIZE',
7446 + 'value' => MAX_AVATAR_SIZE));
7447 hunk ./actions/profilesettings.php 158
7448 - common_element_start('p');
7449 + common_element_start('p');
7450 hunk ./actions/profilesettings.php 161
7451 - common_element('input', array('name' => 'avatarfile',
7453 - 'id' => 'avatarfile'));
7454 - common_element_end('p');
7455 + common_element('input', array('name' => 'avatarfile',
7457 + 'id' => 'avatarfile'));
7458 + common_element_end('p');
7459 hunk ./actions/profilesettings.php 166
7460 - common_submit('upload', _('Upload'));
7461 - common_element_end('form');
7462 + common_submit('upload', _('Upload'));
7463 + common_element_end('form');
7464 hunk ./actions/profilesettings.php 169
7467 hunk ./actions/profilesettings.php 171
7468 - function show_password_form() {
7469 + function show_password_form() {
7470 hunk ./actions/profilesettings.php 173
7471 - $user = common_current_user();
7472 - common_element_start('form', array('method' => 'POST',
7473 - 'id' => 'password',
7475 - common_local_url('profilesettings')));
7476 + $user = common_current_user();
7477 + common_element_start('form', array('method' => 'POST',
7478 + 'id' => 'password',
7480 + common_local_url('profilesettings')));
7481 hunk ./actions/profilesettings.php 179
7482 - common_hidden('token', common_session_token());
7483 + common_hidden('token', common_session_token());
7484 hunk ./actions/profilesettings.php 181
7485 - # Users who logged in with OpenID won't have a pwd
7486 - if ($user->password) {
7487 - common_password('oldpassword', _('Old password'));
7489 - common_password('newpassword', _('New password'),
7490 - _('6 or more characters'));
7491 - common_password('confirm', _('Confirm'),
7492 - _('same as password above'));
7493 - common_submit('changepass', _('Change'));
7494 - common_element_end('form');
7496 + # Users who logged in with OpenID won't have a pwd
7497 + if ($user->password) {
7498 + common_password('oldpassword', _('Old password'));
7500 + common_password('newpassword', _('New password'),
7501 + _('6 or more characters'));
7502 + common_password('confirm', _('Confirm'),
7503 + _('same as password above'));
7504 + common_submit('changepass', _('Change'));
7505 + common_element_end('form');
7507 hunk ./actions/profilesettings.php 193
7508 - function save_profile() {
7509 - $nickname = $this->trimmed('nickname');
7510 - $fullname = $this->trimmed('fullname');
7511 - $homepage = $this->trimmed('homepage');
7512 - $bio = $this->trimmed('bio');
7513 - $location = $this->trimmed('location');
7514 - $autosubscribe = $this->boolean('autosubscribe');
7515 - $language = $this->trimmed('language');
7516 - $timezone = $this->trimmed('timezone');
7517 - $tagstring = $this->trimmed('tags');
7520 + function save_profile() {
7521 + $nickname = $this->trimmed('nickname');
7522 + $fullname = $this->trimmed('fullname');
7523 + $homepage = $this->trimmed('homepage');
7524 + $bio = $this->trimmed('bio');
7525 + $location = $this->trimmed('location');
7526 + $autosubscribe = $this->boolean('autosubscribe');
7527 + $language = $this->trimmed('language');
7528 + $timezone = $this->trimmed('timezone');
7529 + $tagstring = $this->trimmed('tags');
7532 hunk ./actions/profilesettings.php 206
7533 - if (!Validate::string($nickname, array('min_length' => 1,
7534 - 'max_length' => 64,
7535 - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
7536 - $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
7538 - } else if (!User::allowed_nickname($nickname)) {
7539 - $this->show_form(_('Not a valid nickname.'));
7541 - } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
7542 - !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
7543 - $this->show_form(_('Homepage is not a valid URL.'));
7545 - } else if (!is_null($fullname) && strlen($fullname) > 255) {
7546 - $this->show_form(_('Full name is too long (max 255 chars).'));
7548 - } else if (!is_null($bio) && strlen($bio) > 140) {
7549 - $this->show_form(_('Bio is too long (max 140 chars).'));
7551 - } else if (!is_null($location) && strlen($location) > 255) {
7552 - $this->show_form(_('Location is too long (max 255 chars).'));
7554 - } else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
7555 - $this->show_form(_('Timezone not selected.'));
7557 - } else if ($this->nickname_exists($nickname)) {
7558 - $this->show_form(_('Nickname already in use. Try another one.'));
7560 + if (!Validate::string($nickname, array('min_length' => 1,
7561 + 'max_length' => 64,
7562 + 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
7563 + $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
7565 + } else if (!User::allowed_nickname($nickname)) {
7566 + $this->show_form(_('Not a valid nickname.'));
7568 + } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
7569 + !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
7570 + $this->show_form(_('Homepage is not a valid URL.'));
7572 + } else if (!is_null($fullname) && strlen($fullname) > 255) {
7573 + $this->show_form(_('Full name is too long (max 255 chars).'));
7575 + } else if (!is_null($bio) && strlen($bio) > 140) {
7576 + $this->show_form(_('Bio is too long (max 140 chars).'));
7578 + } else if (!is_null($location) && strlen($location) > 255) {
7579 + $this->show_form(_('Location is too long (max 255 chars).'));
7581 + } else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
7582 + $this->show_form(_('Timezone not selected.'));
7584 + } else if ($this->nickname_exists($nickname)) {
7585 + $this->show_form(_('Nickname already in use. Try another one.'));
7587 hunk ./actions/profilesettings.php 234
7588 - $this->show_form(_('Language is too long (max 50 chars).'));
7591 + $this->show_form(_('Language is too long (max 50 chars).'));
7594 hunk ./actions/profilesettings.php 238
7596 - $tags = array_map('common_canonical_tag', preg_split('/[\s,]+/', $tagstring));
7601 - foreach ($tags as $tag) {
7602 - if (!common_valid_profile_tag($tag)) {
7603 - $this->show_form(sprintf(_('Invalid tag: "%s"'), $tag));
7608 - $user = common_current_user();
7610 + $tags = array_map('common_canonical_tag', preg_split('/[\s,]+/', $tagstring));
7615 + foreach ($tags as $tag) {
7616 + if (!common_valid_profile_tag($tag)) {
7617 + $this->show_form(sprintf(_('Invalid tag: "%s"'), $tag));
7622 + $user = common_current_user();
7623 hunk ./actions/profilesettings.php 253
7624 - $user->query('BEGIN');
7625 + $user->query('BEGIN');
7626 hunk ./actions/profilesettings.php 255
7627 - if ($user->nickname != $nickname ||
7628 - $user->language != $language ||
7629 - $user->timezone != $timezone) {
7630 + if ($user->nickname != $nickname ||
7631 + $user->language != $language ||
7632 + $user->timezone != $timezone) {
7633 hunk ./actions/profilesettings.php 259
7634 - common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
7636 - common_debug('Updating user language from ' . $user->language . ' to ' . $language,
7638 - common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone,
7640 + common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
7642 + common_debug('Updating user language from ' . $user->language . ' to ' . $language,
7644 + common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone,
7646 hunk ./actions/profilesettings.php 266
7647 - $original = clone($user);
7648 + $original = clone($user);
7649 hunk ./actions/profilesettings.php 268
7650 - $user->nickname = $nickname;
7651 - $user->language = $language;
7652 - $user->timezone = $timezone;
7653 + $user->nickname = $nickname;
7654 + $user->language = $language;
7655 + $user->timezone = $timezone;
7656 hunk ./actions/profilesettings.php 272
7657 - $result = $user->updateKeys($original);
7658 + $result = $user->updateKeys($original);
7659 hunk ./actions/profilesettings.php 274
7660 - if ($result === FALSE) {
7661 - common_log_db_error($user, 'UPDATE', __FILE__);
7662 - common_server_error(_('Couldn\'t update user.'));
7665 - # Re-initialize language environment if it changed
7666 - common_init_language();
7669 + if ($result === FALSE) {
7670 + common_log_db_error($user, 'UPDATE', __FILE__);
7671 + common_server_error(_('Couldn\'t update user.'));
7674 + # Re-initialize language environment if it changed
7675 + common_init_language();
7678 hunk ./actions/profilesettings.php 284
7681 hunk ./actions/profilesettings.php 286
7682 - if ($user->autosubscribe ^ $autosubscribe) {
7683 + if ($user->autosubscribe ^ $autosubscribe) {
7684 hunk ./actions/profilesettings.php 288
7685 - $original = clone($user);
7686 + $original = clone($user);
7687 hunk ./actions/profilesettings.php 290
7688 - $user->autosubscribe = $autosubscribe;
7689 + $user->autosubscribe = $autosubscribe;
7690 hunk ./actions/profilesettings.php 292
7691 - $result = $user->update($original);
7692 + $result = $user->update($original);
7693 hunk ./actions/profilesettings.php 294
7694 - if ($result === FALSE) {
7695 - common_log_db_error($user, 'UPDATE', __FILE__);
7696 - common_server_error(_('Couldn\'t update user for autosubscribe.'));
7700 + if ($result === FALSE) {
7701 + common_log_db_error($user, 'UPDATE', __FILE__);
7702 + common_server_error(_('Couldn\'t update user for autosubscribe.'));
7706 hunk ./actions/profilesettings.php 301
7707 - $profile = $user->getProfile();
7708 + $profile = $user->getProfile();
7709 hunk ./actions/profilesettings.php 303
7710 - $orig_profile = clone($profile);
7711 + $orig_profile = clone($profile);
7712 hunk ./actions/profilesettings.php 305
7713 - $profile->nickname = $user->nickname;
7714 - $profile->fullname = $fullname;
7715 - $profile->homepage = $homepage;
7716 - $profile->bio = $bio;
7717 - $profile->location = $location;
7718 - $profile->profileurl = common_profile_url($nickname);
7719 + $profile->nickname = $user->nickname;
7720 + $profile->fullname = $fullname;
7721 + $profile->homepage = $homepage;
7722 + $profile->bio = $bio;
7723 + $profile->location = $location;
7724 + $profile->profileurl = common_profile_url($nickname);
7725 hunk ./actions/profilesettings.php 312
7726 - common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
7727 - common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
7728 + common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
7729 + common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
7730 hunk ./actions/profilesettings.php 315
7731 - $result = $profile->update($orig_profile);
7732 + $result = $profile->update($orig_profile);
7733 hunk ./actions/profilesettings.php 317
7735 - common_log_db_error($profile, 'UPDATE', __FILE__);
7736 - common_server_error(_('Couldn\'t save profile.'));
7740 + common_log_db_error($profile, 'UPDATE', __FILE__);
7741 + common_server_error(_('Couldn\'t save profile.'));
7744 hunk ./actions/profilesettings.php 323
7745 - # Set the user tags
7747 - $result = $user->setSelfTags($tags);
7748 + # Set the user tags
7750 + $result = $user->setSelfTags($tags);
7751 hunk ./actions/profilesettings.php 327
7753 - common_server_error(_('Couldn\'t save tags.'));
7757 - $user->query('COMMIT');
7759 + common_server_error(_('Couldn\'t save tags.'));
7763 + $user->query('COMMIT');
7764 hunk ./actions/profilesettings.php 334
7765 - common_broadcast_profile($profile);
7766 + common_broadcast_profile($profile);
7767 hunk ./actions/profilesettings.php 336
7768 - $this->show_form(_('Settings saved.'), TRUE);
7770 + $this->show_form(_('Settings saved.'), TRUE);
7772 hunk ./actions/profilesettings.php 340
7773 - function upload_avatar() {
7774 - switch ($_FILES['avatarfile']['error']) {
7775 - case UPLOAD_ERR_OK: # success, jump out
7777 - case UPLOAD_ERR_INI_SIZE:
7778 - case UPLOAD_ERR_FORM_SIZE:
7779 - $this->show_form(_('That file is too big.'));
7781 - case UPLOAD_ERR_PARTIAL:
7782 - @unlink($_FILES['avatarfile']['tmp_name']);
7783 - $this->show_form(_('Partial upload.'));
7786 - $this->show_form(_('System error uploading file.'));
7789 + function upload_avatar() {
7790 + switch ($_FILES['avatarfile']['error']) {
7791 + case UPLOAD_ERR_OK: # success, jump out
7793 + case UPLOAD_ERR_INI_SIZE:
7794 + case UPLOAD_ERR_FORM_SIZE:
7795 + $this->show_form(_('That file is too big.'));
7797 + case UPLOAD_ERR_PARTIAL:
7798 + @unlink($_FILES['avatarfile']['tmp_name']);
7799 + $this->show_form(_('Partial upload.'));
7802 + $this->show_form(_('System error uploading file.'));
7805 hunk ./actions/profilesettings.php 357
7806 - $info = @getimagesize($_FILES['avatarfile']['tmp_name']);
7807 + $info = @getimagesize($_FILES['avatarfile']['tmp_name']);
7808 hunk ./actions/profilesettings.php 359
7810 - @unlink($_FILES['avatarfile']['tmp_name']);
7811 - $this->show_form(_('Not an image or corrupt file.'));
7815 + @unlink($_FILES['avatarfile']['tmp_name']);
7816 + $this->show_form(_('Not an image or corrupt file.'));
7819 hunk ./actions/profilesettings.php 365
7820 - switch ($info[2]) {
7821 - case IMAGETYPE_GIF:
7822 - case IMAGETYPE_JPEG:
7823 - case IMAGETYPE_PNG:
7826 - $this->show_form(_('Unsupported image file format.'));
7829 + switch ($info[2]) {
7830 + case IMAGETYPE_GIF:
7831 + case IMAGETYPE_JPEG:
7832 + case IMAGETYPE_PNG:
7835 + $this->show_form(_('Unsupported image file format.'));
7838 hunk ./actions/profilesettings.php 375
7839 - $user = common_current_user();
7840 - $profile = $user->getProfile();
7841 + $user = common_current_user();
7842 + $profile = $user->getProfile();
7843 hunk ./actions/profilesettings.php 378
7844 - if ($profile->setOriginal($_FILES['avatarfile']['tmp_name'])) {
7845 - $this->show_form(_('Avatar updated.'), true);
7847 - $this->show_form(_('Failed updating avatar.'));
7849 + if ($profile->setOriginal($_FILES['avatarfile']['tmp_name'])) {
7850 + $this->show_form(_('Avatar updated.'), true);
7852 + $this->show_form(_('Failed updating avatar.'));
7854 hunk ./actions/profilesettings.php 384
7855 - @unlink($_FILES['avatarfile']['tmp_name']);
7857 + @unlink($_FILES['avatarfile']['tmp_name']);
7859 hunk ./actions/profilesettings.php 387
7860 - function nickname_exists($nickname) {
7861 - $user = common_current_user();
7862 - $other = User::staticGet('nickname', $nickname);
7866 - return $other->id != $user->id;
7869 + function nickname_exists($nickname) {
7870 + $user = common_current_user();
7871 + $other = User::staticGet('nickname', $nickname);
7875 + return $other->id != $user->id;
7878 hunk ./actions/profilesettings.php 397
7879 - function change_password() {
7880 + function change_password() {
7881 hunk ./actions/profilesettings.php 399
7882 - $user = common_current_user();
7883 - assert(!is_null($user)); # should already be checked
7884 + $user = common_current_user();
7885 + assert(!is_null($user)); # should already be checked
7886 hunk ./actions/profilesettings.php 402
7887 - # FIXME: scrub input
7888 + # FIXME: scrub input
7889 hunk ./actions/profilesettings.php 404
7890 - $newpassword = $this->arg('newpassword');
7891 - $confirm = $this->arg('confirm');
7892 - $token = $this->arg('token');
7893 + $newpassword = $this->arg('newpassword');
7894 + $confirm = $this->arg('confirm');
7895 + $token = $this->arg('token');
7896 hunk ./actions/profilesettings.php 408
7897 - if (0 != strcmp($newpassword, $confirm)) {
7898 - $this->show_form(_('Passwords don\'t match.'));
7901 + if (0 != strcmp($newpassword, $confirm)) {
7902 + $this->show_form(_('Passwords don\'t match.'));
7905 hunk ./actions/profilesettings.php 413
7906 - if ($user->password) {
7907 - $oldpassword = $this->arg('oldpassword');
7908 + if ($user->password) {
7909 + $oldpassword = $this->arg('oldpassword');
7910 hunk ./actions/profilesettings.php 416
7911 - if (!common_check_user($user->nickname, $oldpassword)) {
7912 - $this->show_form(_('Incorrect old password'));
7916 + if (!common_check_user($user->nickname, $oldpassword)) {
7917 + $this->show_form(_('Incorrect old password'));
7921 hunk ./actions/profilesettings.php 422
7922 - $original = clone($user);
7923 + $original = clone($user);
7924 hunk ./actions/profilesettings.php 424
7925 - $user->password = common_munge_password($newpassword, $user->id);
7926 + $user->password = common_munge_password($newpassword, $user->id);
7927 hunk ./actions/profilesettings.php 426
7928 - $val = $user->validate();
7929 - if ($val !== TRUE) {
7930 - $this->show_form(_('Error saving user; invalid.'));
7933 + $val = $user->validate();
7934 + if ($val !== TRUE) {
7935 + $this->show_form(_('Error saving user; invalid.'));
7938 hunk ./actions/profilesettings.php 432
7939 - if (!$user->update($original)) {
7940 - common_server_error(_('Can\'t save new password.'));
7943 + if (!$user->update($original)) {
7944 + common_server_error(_('Can\'t save new password.'));
7947 hunk ./actions/profilesettings.php 437
7948 - $this->show_form(_('Password saved.'), true);
7950 + $this->show_form(_('Password saved.'), true);
7952 hunk ./actions/public.php 26
7953 - function handle($args) {
7954 - parent::handle($args);
7955 + function handle($args) {
7956 + parent::handle($args);
7957 hunk ./actions/public.php 29
7958 - $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
7959 + $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
7960 hunk ./actions/public.php 31
7961 - header('X-XRDS-Location: '. common_local_url('publicxrds'));
7962 + header('X-XRDS-Location: '. common_local_url('publicxrds'));
7963 hunk ./actions/public.php 33
7964 - common_show_header(_('Public timeline'),
7965 - array($this, 'show_header'), NULL,
7966 - array($this, 'show_top'));
7967 + common_show_header(_('Public timeline'),
7968 + array($this, 'show_header'), NULL,
7969 + array($this, 'show_top'));
7970 hunk ./actions/public.php 37
7971 - # XXX: Public sidebar here?
7972 + # XXX: Public sidebar here?
7973 hunk ./actions/public.php 39
7974 - $this->show_notices($page);
7975 + $this->show_notices($page);
7976 hunk ./actions/public.php 41
7977 - common_show_footer();
7979 + common_show_footer();
7981 hunk ./actions/public.php 44
7982 - function show_top() {
7983 - if (common_logged_in()) {
7984 - common_notice_form('public');
7986 - $instr = $this->get_instructions();
7987 - $output = common_markup_to_html($instr);
7988 - common_element_start('div', 'instructions');
7989 - common_raw($output);
7990 - common_element_end('div');
7992 + function show_top() {
7993 + if (common_logged_in()) {
7994 + common_notice_form('public');
7996 + $instr = $this->get_instructions();
7997 + $output = common_markup_to_html($instr);
7998 + common_element_start('div', 'instructions');
7999 + common_raw($output);
8000 + common_element_end('div');
8002 hunk ./actions/public.php 55
8003 - $this->public_views_menu();
8004 + $this->public_views_menu();
8005 hunk ./actions/public.php 57
8006 - $this->show_feeds_list(array(0=>array('href'=>common_local_url('publicrss'),
8008 - 'version' => 'RSS 1.0',
8009 - 'item' => 'publicrss'),
8010 - 1=>array('href'=>common_local_url('publicatom'),
8012 - 'version' => 'Atom 1.0',
8013 - 'item' => 'publicatom')));
8015 + $this->show_feeds_list(array(0=>array('href'=>common_local_url('publicrss'),
8017 + 'version' => 'RSS 1.0',
8018 + 'item' => 'publicrss'),
8019 + 1=>array('href'=>common_local_url('publicatom'),
8021 + 'version' => 'Atom 1.0',
8022 + 'item' => 'publicatom')));
8024 hunk ./actions/public.php 67
8025 - function get_instructions() {
8026 - return _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
8027 - 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
8028 - '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
8030 + function get_instructions() {
8031 + return _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
8032 + 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
8033 + '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
8035 hunk ./actions/public.php 73
8036 - function show_header() {
8037 - common_element('link', array('rel' => 'alternate',
8038 - 'href' => common_local_url('publicrss'),
8039 - 'type' => 'application/rss+xml',
8040 - 'title' => _('Public Stream Feed')));
8041 - # for client side of OpenID authentication
8042 - common_element('meta', array('http-equiv' => 'X-XRDS-Location',
8043 - 'content' => common_local_url('publicxrds')));
8045 + function show_header() {
8046 + common_element('link', array('rel' => 'alternate',
8047 + 'href' => common_local_url('publicrss'),
8048 + 'type' => 'application/rss+xml',
8049 + 'title' => _('Public Stream Feed')));
8050 + # for client side of OpenID authentication
8051 + common_element('meta', array('http-equiv' => 'X-XRDS-Location',
8052 + 'content' => common_local_url('publicxrds')));
8054 hunk ./actions/public.php 83
8055 - function show_notices($page) {
8056 + function show_notices($page) {
8057 hunk ./actions/public.php 85
8059 - $notice = Notice::publicStream(($page-1)*NOTICES_PER_PAGE,
8060 - NOTICES_PER_PAGE + 1);
8062 + $notice = Notice::publicStream(($page-1)*NOTICES_PER_PAGE,
8063 + NOTICES_PER_PAGE + 1);
8064 hunk ./actions/public.php 89
8067 hunk ./actions/public.php 92
8070 hunk ./actions/public.php 96
8071 - common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
8074 + common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
8077 hunk ./actions/publicrss.php 28
8084 hunk ./actions/publicrss.php 32
8085 - function get_notices($limit=0) {
8087 - $notices = array();
8089 - $notice = Notice::publicStream(0, ($limit == 0) ? 48 : $limit);
8091 - while ($notice->fetch()) {
8092 - $notices[] = clone($notice);
8097 + function get_notices($limit=0) {
8099 + $notices = array();
8101 + $notice = Notice::publicStream(0, ($limit == 0) ? 48 : $limit);
8103 + while ($notice->fetch()) {
8104 + $notices[] = clone($notice);
8109 hunk ./actions/publicrss.php 45
8110 - function get_channel() {
8112 - $c = array('url' => common_local_url('publicrss'),
8113 - 'title' => sprintf(_('%s Public Stream'), $config['site']['name']),
8114 - 'link' => common_local_url('public'),
8115 - 'description' => sprintf(_('All updates for %s'), $config['site']['name']));
8118 + function get_channel() {
8120 + $c = array('url' => common_local_url('publicrss'),
8121 + 'title' => sprintf(_('%s Public Stream'), $config['site']['name']),
8122 + 'link' => common_local_url('public'),
8123 + 'description' => sprintf(_('All updates for %s'), $config['site']['name']));
8126 hunk ./actions/publicrss.php 54
8127 - function get_image() {
8130 + function get_image() {
8133 hunk ./actions/publicxrds.php 28
8134 - function is_readonly() {
8137 + function is_readonly() {
8140 hunk ./actions/publicxrds.php 32
8141 - function handle($args) {
8142 + function handle($args) {
8143 hunk ./actions/publicxrds.php 34
8144 - parent::handle($args);
8145 + parent::handle($args);
8146 hunk ./actions/publicxrds.php 36
8147 - header('Content-Type: application/xrds+xml');
8148 + header('Content-Type: application/xrds+xml');
8149 hunk ./actions/publicxrds.php 38
8150 - common_start_xml();
8151 - common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
8152 + common_start_xml();
8153 + common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
8154 hunk ./actions/publicxrds.php 41
8155 - common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
8156 - 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
8157 - 'version' => '2.0'));
8158 + common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
8159 + 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
8160 + 'version' => '2.0'));
8161 hunk ./actions/publicxrds.php 45
8162 - common_element('Type', NULL, 'xri://$xrds*simple');
8163 + common_element('Type', NULL, 'xri://$xrds*simple');
8164 hunk ./actions/publicxrds.php 47
8165 - foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
8166 - $this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
8167 - common_local_url($finish));
8169 + foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
8170 + $this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
8171 + common_local_url($finish));
8173 hunk ./actions/publicxrds.php 52
8174 - common_element_end('XRD');
8175 + common_element_end('XRD');
8176 hunk ./actions/publicxrds.php 54
8177 - common_element_end('XRDS');
8180 + common_element_end('XRDS');
8183 hunk ./actions/publicxrds.php 58
8184 - function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
8185 - common_element_start('Service');
8187 - common_element('URI', NULL, $uri);
8189 - common_element('Type', NULL, $type);
8191 - foreach ($params as $param) {
8192 - common_element('Type', NULL, $param);
8196 - foreach ($sigs as $sig) {
8197 - common_element('Type', NULL, $sig);
8201 - common_element('LocalID', NULL, $localId);
8203 - common_element_end('Service');
8205 + function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
8206 + common_element_start('Service');
8208 + common_element('URI', NULL, $uri);
8210 + common_element('Type', NULL, $type);
8212 + foreach ($params as $param) {
8213 + common_element('Type', NULL, $param);
8217 + foreach ($sigs as $sig) {
8218 + common_element('Type', NULL, $sig);
8222 + common_element('LocalID', NULL, $localId);
8224 + common_element_end('Service');
8226 hunk ./actions/recoverpassword.php 31
8227 - $this->client_error(_('You are already logged in!'));
8228 + $this->client_error(_('You are already logged in!'));
8229 hunk ./actions/recoverpassword.php 34
8230 - if ($this->arg('recover')) {
8231 - $this->recover_password();
8232 + if ($this->arg('recover')) {
8233 + $this->recover_password();
8234 hunk ./actions/recoverpassword.php 37
8235 - $this->reset_password();
8237 - $this->client_error(_('Unexpected form submission.'));
8240 - if ($this->trimmed('code')) {
8241 - $this->check_code();
8243 - $this->show_form();
8247 + $this->reset_password();
8249 + $this->client_error(_('Unexpected form submission.'));
8252 + if ($this->trimmed('code')) {
8253 + $this->check_code();
8255 + $this->show_form();
8259 hunk ./actions/recoverpassword.php 50
8260 - function check_code() {
8261 + function check_code() {
8262 hunk ./actions/recoverpassword.php 52
8263 - $code = $this->trimmed('code');
8264 - $confirm = Confirm_address::staticGet('code', $code);
8265 + $code = $this->trimmed('code');
8266 + $confirm = Confirm_address::staticGet('code', $code);
8267 hunk ./actions/recoverpassword.php 55
8269 - $this->client_error(_('No such recovery code.'));
8272 - if ($confirm->address_type != 'recover') {
8273 - $this->client_error(_('Not a recovery code.'));
8277 + $this->client_error(_('No such recovery code.'));
8280 + if ($confirm->address_type != 'recover') {
8281 + $this->client_error(_('Not a recovery code.'));
8284 hunk ./actions/recoverpassword.php 64
8285 - $user = User::staticGet($confirm->user_id);
8286 + $user = User::staticGet($confirm->user_id);
8287 hunk ./actions/recoverpassword.php 66
8289 - $this->server_error(_('Recovery code for unknown user.'));
8293 + $this->server_error(_('Recovery code for unknown user.'));
8296 hunk ./actions/recoverpassword.php 71
8297 - $touched = strtotime($confirm->modified);
8298 - $email = $confirm->address;
8299 + $touched = strtotime($confirm->modified);
8300 + $email = $confirm->address;
8301 hunk ./actions/recoverpassword.php 74
8304 hunk ./actions/recoverpassword.php 76
8305 - $result = $confirm->delete();
8306 + $result = $confirm->delete();
8307 hunk ./actions/recoverpassword.php 78
8309 - common_log_db_error($confirm, 'DELETE', __FILE__);
8310 - common_server_error(_('Error with confirmation code.'));
8314 + common_log_db_error($confirm, 'DELETE', __FILE__);
8315 + common_server_error(_('Error with confirmation code.'));
8318 hunk ./actions/recoverpassword.php 84
8319 - # These should be reaped, but for now we just check mod time
8320 - # Note: it's still deleted; let's avoid a second attempt!
8321 + # These should be reaped, but for now we just check mod time
8322 + # Note: it's still deleted; let's avoid a second attempt!
8323 hunk ./actions/recoverpassword.php 87
8324 - if ((time() - $touched) > MAX_RECOVERY_TIME) {
8325 - common_log(LOG_WARNING,
8326 - 'Attempted redemption on recovery code ' .
8327 - 'that is ' . $touched . ' seconds old. ');
8328 - $this->client_error(_('This confirmation code is too old. ' .
8329 - 'Please start again.'));
8332 + if ((time() - $touched) > MAX_RECOVERY_TIME) {
8333 + common_log(LOG_WARNING,
8334 + 'Attempted redemption on recovery code ' .
8335 + 'that is ' . $touched . ' seconds old. ');
8336 + $this->client_error(_('This confirmation code is too old. ' .
8337 + 'Please start again.'));
8340 hunk ./actions/recoverpassword.php 96
8341 - # If we used an outstanding confirmation to send the email,
8342 - # it's been confirmed at this point.
8343 + # If we used an outstanding confirmation to send the email,
8344 + # it's been confirmed at this point.
8345 hunk ./actions/recoverpassword.php 99
8346 - if (!$user->email) {
8347 - $orig = clone($user);
8348 - $user->email = $email;
8349 - $result = $user->updateKeys($orig);
8351 - common_log_db_error($user, 'UPDATE', __FILE__);
8352 - $this->server_error(_('Could not update user with confirmed email address.'));
8356 + if (!$user->email) {
8357 + $orig = clone($user);
8358 + $user->email = $email;
8359 + $result = $user->updateKeys($orig);
8361 + common_log_db_error($user, 'UPDATE', __FILE__);
8362 + $this->server_error(_('Could not update user with confirmed email address.'));
8366 hunk ./actions/recoverpassword.php 110
8369 hunk ./actions/recoverpassword.php 112
8370 - $this->set_temp_user($user);
8371 - $this->show_password_form();
8373 + $this->set_temp_user($user);
8374 + $this->show_password_form();
8376 hunk ./actions/recoverpassword.php 116
8377 - function set_temp_user(&$user) {
8378 - common_ensure_session();
8379 - $_SESSION['tempuser'] = $user->id;
8381 + function set_temp_user(&$user) {
8382 + common_ensure_session();
8383 + $_SESSION['tempuser'] = $user->id;
8385 hunk ./actions/recoverpassword.php 121
8386 - function get_temp_user() {
8387 - common_ensure_session();
8388 - $user_id = $_SESSION['tempuser'];
8390 - $user = User::staticGet($user_id);
8394 + function get_temp_user() {
8395 + common_ensure_session();
8396 + $user_id = $_SESSION['tempuser'];
8398 + $user = User::staticGet($user_id);
8402 hunk ./actions/recoverpassword.php 130
8403 - function clear_temp_user() {
8404 - common_ensure_session();
8405 - unset($_SESSION['tempuser']);
8407 + function clear_temp_user() {
8408 + common_ensure_session();
8409 + unset($_SESSION['tempuser']);
8411 hunk ./actions/recoverpassword.php 135
8412 - function show_top($msg=NULL) {
8414 + function show_top($msg=NULL) {
8416 hunk ./actions/recoverpassword.php 138
8418 - common_element_start('div', 'instructions');
8419 - common_element('p', NULL,
8420 - _('If you\'ve forgotten or lost your' .
8421 - ' password, you can get a new one sent to' .
8422 - ' the email address you have stored ' .
8423 - ' in your account.'));
8424 - common_element_end('div');
8428 + common_element_start('div', 'instructions');
8429 + common_element('p', NULL,
8430 + _('If you\'ve forgotten or lost your' .
8431 + ' password, you can get a new one sent to' .
8432 + ' the email address you have stored ' .
8433 + ' in your account.'));
8434 + common_element_end('div');
8437 hunk ./actions/recoverpassword.php 149
8438 - function show_password_top($msg=NULL) {
8440 + function show_password_top($msg=NULL) {
8442 hunk ./actions/recoverpassword.php 152
8444 - common_element('div', 'instructions',
8445 - _('You\'ve been identified. Enter a ' .
8446 - ' new password below. '));
8450 + common_element('div', 'instructions',
8451 + _('You\'ve been identified. Enter a ' .
8452 + ' new password below. '));
8455 hunk ./actions/recoverpassword.php 159
8456 - function show_form($msg=NULL) {
8457 + function show_form($msg=NULL) {
8458 hunk ./actions/recoverpassword.php 161
8459 - common_show_header(_('Recover password'), NULL,
8460 - $msg, array($this, 'show_top'));
8461 + common_show_header(_('Recover password'), NULL,
8462 + $msg, array($this, 'show_top'));
8463 hunk ./actions/recoverpassword.php 164
8464 - common_element_start('form', array('method' => 'post',
8465 - 'id' => 'recoverpassword',
8466 - 'action' => common_local_url('recoverpassword')));
8467 - common_input('nicknameoremail', _('Nickname or email'),
8468 - $this->trimmed('nicknameoremail'),
8469 - _('Your nickname on this server, ' .
8470 - 'or your registered email address.'));
8471 - common_submit('recover', _('Recover'));
8472 - common_element_end('form');
8473 - common_show_footer();
8475 + common_element_start('form', array('method' => 'post',
8476 + 'id' => 'recoverpassword',
8477 + 'action' => common_local_url('recoverpassword')));
8478 + common_input('nicknameoremail', _('Nickname or email'),
8479 + $this->trimmed('nicknameoremail'),
8480 + _('Your nickname on this server, ' .
8481 + 'or your registered email address.'));
8482 + common_submit('recover', _('Recover'));
8483 + common_element_end('form');
8484 + common_show_footer();
8486 hunk ./actions/recoverpassword.php 176
8487 - function show_password_form($msg=NULL) {
8488 + function show_password_form($msg=NULL) {
8489 hunk ./actions/recoverpassword.php 178
8490 - common_show_header(_('Reset password'), NULL,
8491 - $msg, array($this, 'show_password_top'));
8492 + common_show_header(_('Reset password'), NULL,
8493 + $msg, array($this, 'show_password_top'));
8494 hunk ./actions/recoverpassword.php 181
8495 - common_element_start('form', array('method' => 'post',
8496 - 'id' => 'recoverpassword',
8497 - 'action' => common_local_url('recoverpassword')));
8498 - common_hidden('token', common_session_token());
8499 - common_password('newpassword', _('New password'),
8500 - _('6 or more characters, and don\'t forget it!'));
8501 - common_password('confirm', _('Confirm'),
8502 - _('Same as password above'));
8503 - common_submit('reset', _('Reset'));
8504 - common_element_end('form');
8505 - common_show_footer();
8507 + common_element_start('form', array('method' => 'post',
8508 + 'id' => 'recoverpassword',
8509 + 'action' => common_local_url('recoverpassword')));
8510 + common_hidden('token', common_session_token());
8511 + common_password('newpassword', _('New password'),
8512 + _('6 or more characters, and don\'t forget it!'));
8513 + common_password('confirm', _('Confirm'),
8514 + _('Same as password above'));
8515 + common_submit('reset', _('Reset'));
8516 + common_element_end('form');
8517 + common_show_footer();
8519 hunk ./actions/recoverpassword.php 194
8520 - function recover_password() {
8521 - $nore = $this->trimmed('nicknameoremail');
8523 - $this->show_form(_('Enter a nickname or email address.'));
8526 + function recover_password() {
8527 + $nore = $this->trimmed('nicknameoremail');
8529 + $this->show_form(_('Enter a nickname or email address.'));
8532 hunk ./actions/recoverpassword.php 201
8533 - $user = User::staticGet('email', common_canonical_email($nore));
8534 + $user = User::staticGet('email', common_canonical_email($nore));
8535 hunk ./actions/recoverpassword.php 203
8537 - $user = User::staticGet('nickname', common_canonical_nickname($nore));
8540 + $user = User::staticGet('nickname', common_canonical_nickname($nore));
8542 hunk ./actions/recoverpassword.php 207
8543 - # See if it's an unconfirmed email address
8544 + # See if it's an unconfirmed email address
8545 hunk ./actions/recoverpassword.php 209
8547 - $confirm_email = Confirm_address::staticGet('address', common_canonical_email($nore));
8548 - if ($confirm_email && $confirm_email->address_type == 'email') {
8549 - $user = User::staticGet($confirm_email->user_id);
8553 + $confirm_email = Confirm_address::staticGet('address', common_canonical_email($nore));
8554 + if ($confirm_email && $confirm_email->address_type == 'email') {
8555 + $user = User::staticGet($confirm_email->user_id);
8558 hunk ./actions/recoverpassword.php 216
8560 - $this->show_form(_('No user with that email address or username.'));
8564 + $this->show_form(_('No user with that email address or username.'));
8567 hunk ./actions/recoverpassword.php 221
8568 - # Try to get an unconfirmed email address if they used a user name
8569 + # Try to get an unconfirmed email address if they used a user name
8570 hunk ./actions/recoverpassword.php 223
8571 - if (!$user->email && !$confirm_email) {
8572 - $confirm_email = Confirm_address::staticGet('user_id', $user->id);
8573 - if ($confirm_email && $confirm_email->address_type != 'email') {
8574 - # Skip non-email confirmations
8575 - $confirm_email = NULL;
8578 + if (!$user->email && !$confirm_email) {
8579 + $confirm_email = Confirm_address::staticGet('user_id', $user->id);
8580 + if ($confirm_email && $confirm_email->address_type != 'email') {
8581 + # Skip non-email confirmations
8582 + $confirm_email = NULL;
8585 hunk ./actions/recoverpassword.php 231
8586 - if (!$user->email && !$confirm_email) {
8587 - $this->client_error(_('No registered email address for that user.'));
8590 + if (!$user->email && !$confirm_email) {
8591 + $this->client_error(_('No registered email address for that user.'));
8594 hunk ./actions/recoverpassword.php 236
8595 - # Success! We have a valid user and a confirmed or unconfirmed email address
8596 + # Success! We have a valid user and a confirmed or unconfirmed email address
8597 hunk ./actions/recoverpassword.php 238
8598 - $confirm = new Confirm_address();
8599 - $confirm->code = common_confirmation_code(128);
8600 - $confirm->address_type = 'recover';
8601 - $confirm->user_id = $user->id;
8602 - $confirm->address = (isset($user->email)) ? $user->email : $confirm_email->address;
8603 + $confirm = new Confirm_address();
8604 + $confirm->code = common_confirmation_code(128);
8605 + $confirm->address_type = 'recover';
8606 + $confirm->user_id = $user->id;
8607 + $confirm->address = (isset($user->email)) ? $user->email : $confirm_email->address;
8608 hunk ./actions/recoverpassword.php 244
8609 - if (!$confirm->insert()) {
8610 - common_log_db_error($confirm, 'INSERT', __FILE__);
8611 - $this->server_error(_('Error saving address confirmation.'));
8614 + if (!$confirm->insert()) {
8615 + common_log_db_error($confirm, 'INSERT', __FILE__);
8616 + $this->server_error(_('Error saving address confirmation.'));
8619 hunk ./actions/recoverpassword.php 250
8620 - $body = "Hey, $user->nickname.";
8622 - $body .= 'Someone just asked for a new password ' .
8623 - 'for this account on ' . common_config('site', 'name') . '.';
8625 - $body .= 'If it was you, and you want to confirm, use the URL below:';
8627 - $body .= "\t".common_local_url('recoverpassword',
8628 - array('code' => $confirm->code));
8630 - $body .= 'If not, just ignore this message.';
8632 - $body .= 'Thanks for your time, ';
8634 - $body .= common_config('site', 'name');
8636 + $body = "Hey, $user->nickname.";
8638 + $body .= 'Someone just asked for a new password ' .
8639 + 'for this account on ' . common_config('site', 'name') . '.';
8641 + $body .= 'If it was you, and you want to confirm, use the URL below:';
8643 + $body .= "\t".common_local_url('recoverpassword',
8644 + array('code' => $confirm->code));
8646 + $body .= 'If not, just ignore this message.';
8648 + $body .= 'Thanks for your time, ';
8650 + $body .= common_config('site', 'name');
8652 hunk ./actions/recoverpassword.php 267
8653 - mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
8654 + mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
8655 hunk ./actions/recoverpassword.php 269
8656 - common_show_header(_('Password recovery requested'));
8657 - common_element('p', NULL,
8658 - _('Instructions for recovering your password ' .
8659 - 'have been sent to the email address registered to your ' .
8661 - common_show_footer();
8663 + common_show_header(_('Password recovery requested'));
8664 + common_element('p', NULL,
8665 + _('Instructions for recovering your password ' .
8666 + 'have been sent to the email address registered to your ' .
8668 + common_show_footer();
8670 hunk ./actions/recoverpassword.php 277
8671 - function reset_password() {
8672 + function reset_password() {
8673 hunk ./actions/recoverpassword.php 279
8675 - $token = $this->trimmed('token');
8676 - if (!$token || $token != common_session_token()) {
8677 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
8681 + $token = $this->trimmed('token');
8682 + if (!$token || $token != common_session_token()) {
8683 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
8686 hunk ./actions/recoverpassword.php 286
8687 - $user = $this->get_temp_user();
8688 + $user = $this->get_temp_user();
8689 hunk ./actions/recoverpassword.php 288
8691 - $this->client_error(_('Unexpected password reset.'));
8695 + $this->client_error(_('Unexpected password reset.'));
8698 hunk ./actions/recoverpassword.php 293
8699 - $newpassword = $this->trimmed('newpassword');
8700 - $confirm = $this->trimmed('confirm');
8701 + $newpassword = $this->trimmed('newpassword');
8702 + $confirm = $this->trimmed('confirm');
8703 hunk ./actions/recoverpassword.php 296
8704 - if (!$newpassword || strlen($newpassword) < 6) {
8705 - $this->show_password_form(_('Password must be 6 chars or more.'));
8708 - if ($newpassword != $confirm) {
8709 - $this->show_password_form(_('Password and confirmation do not match.'));
8712 + if (!$newpassword || strlen($newpassword) < 6) {
8713 + $this->show_password_form(_('Password must be 6 chars or more.'));
8716 + if ($newpassword != $confirm) {
8717 + $this->show_password_form(_('Password and confirmation do not match.'));
8720 hunk ./actions/recoverpassword.php 305
8721 - # OK, we're ready to go
8722 + # OK, we're ready to go
8723 hunk ./actions/recoverpassword.php 307
8724 - $original = clone($user);
8725 + $original = clone($user);
8726 hunk ./actions/recoverpassword.php 309
8727 - $user->password = common_munge_password($newpassword, $user->id);
8728 + $user->password = common_munge_password($newpassword, $user->id);
8729 hunk ./actions/recoverpassword.php 311
8730 - if (!$user->update($original)) {
8731 - common_log_db_error($user, 'UPDATE', __FILE__);
8732 - common_server_error(_('Can\'t save new password.'));
8735 + if (!$user->update($original)) {
8736 + common_log_db_error($user, 'UPDATE', __FILE__);
8737 + common_server_error(_('Can\'t save new password.'));
8740 hunk ./actions/recoverpassword.php 317
8741 - $this->clear_temp_user();
8742 + $this->clear_temp_user();
8743 hunk ./actions/recoverpassword.php 319
8744 - if (!common_set_user($user->nickname)) {
8745 - common_server_error(_('Error setting user.'));
8748 + if (!common_set_user($user->nickname)) {
8749 + common_server_error(_('Error setting user.'));
8752 hunk ./actions/recoverpassword.php 324
8753 - common_real_login(true);
8754 + common_real_login(true);
8755 hunk ./actions/recoverpassword.php 326
8756 - common_show_header(_('Password saved.'));
8757 - common_element('p', NULL, _('New password successfully saved. ' .
8758 - 'You are now logged in.'));
8759 - common_show_footer();
8761 + common_show_header(_('Password saved.'));
8762 + common_element('p', NULL, _('New password successfully saved. ' .
8763 + 'You are now logged in.'));
8764 + common_show_footer();
8766 hunk ./actions/register.php 24
8767 - function handle($args) {
8768 - parent::handle($args);
8769 + function handle($args) {
8770 + parent::handle($args);
8771 hunk ./actions/register.php 27
8772 - if (common_config('site', 'closed')) {
8773 - common_user_error(_('Registration not allowed.'));
8774 - } else if (common_logged_in()) {
8775 - common_user_error(_('Already logged in.'));
8776 - } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
8777 - $this->try_register();
8779 - $this->show_form();
8782 + if (common_config('site', 'closed')) {
8783 + common_user_error(_('Registration not allowed.'));
8784 + } else if (common_logged_in()) {
8785 + common_user_error(_('Already logged in.'));
8786 + } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
8787 + $this->try_register();
8789 + $this->show_form();
8792 hunk ./actions/register.php 38
8793 - function try_register() {
8794 + function try_register() {
8795 hunk ./actions/register.php 40
8796 - $token = $this->trimmed('token');
8797 - if (!$token || $token != common_session_token()) {
8798 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
8801 + $token = $this->trimmed('token');
8802 + if (!$token || $token != common_session_token()) {
8803 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
8806 hunk ./actions/register.php 46
8807 - $nickname = $this->trimmed('nickname');
8808 - $email = $this->trimmed('email');
8809 - $fullname = $this->trimmed('fullname');
8810 - $homepage = $this->trimmed('homepage');
8811 - $bio = $this->trimmed('bio');
8812 - $location = $this->trimmed('location');
8813 + $nickname = $this->trimmed('nickname');
8814 + $email = $this->trimmed('email');
8815 + $fullname = $this->trimmed('fullname');
8816 + $homepage = $this->trimmed('homepage');
8817 + $bio = $this->trimmed('bio');
8818 + $location = $this->trimmed('location');
8819 hunk ./actions/register.php 53
8820 - # We don't trim these... whitespace is OK in a password!
8821 + # We don't trim these... whitespace is OK in a password!
8822 hunk ./actions/register.php 55
8823 - $password = $this->arg('password');
8824 - $confirm = $this->arg('confirm');
8825 + $password = $this->arg('password');
8826 + $confirm = $this->arg('confirm');
8827 hunk ./actions/register.php 58
8828 - # invitation code, if any
8829 + # invitation code, if any
8830 hunk ./actions/register.php 60
8831 - $code = $this->trimmed('code');
8832 + $code = $this->trimmed('code');
8833 hunk ./actions/register.php 62
8835 - $invite = Invitation::staticGet($code);
8838 + $invite = Invitation::staticGet($code);
8840 hunk ./actions/register.php 66
8841 - if (common_config('site', 'inviteonly') && !($code && $invite)) {
8842 - $this->client_error(_('Sorry, only invited people can register.'));
8845 + if (common_config('site', 'inviteonly') && !($code && $invite)) {
8846 + $this->client_error(_('Sorry, only invited people can register.'));
8849 hunk ./actions/register.php 71
8852 hunk ./actions/register.php 73
8853 - $nickname = common_canonical_nickname($nickname);
8854 - $email = common_canonical_email($email);
8855 + $nickname = common_canonical_nickname($nickname);
8856 + $email = common_canonical_email($email);
8857 hunk ./actions/register.php 76
8858 - if (!$this->boolean('license')) {
8859 - $this->show_form(_('You can\'t register if you don\'t agree to the license.'));
8860 - } else if ($email && !Validate::email($email, true)) {
8861 - $this->show_form(_('Not a valid email address.'));
8862 - } else if (!Validate::string($nickname, array('min_length' => 1,
8863 - 'max_length' => 64,
8864 - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
8865 - $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
8866 - } else if ($this->nickname_exists($nickname)) {
8867 - $this->show_form(_('Nickname already in use. Try another one.'));
8868 - } else if (!User::allowed_nickname($nickname)) {
8869 - $this->show_form(_('Not a valid nickname.'));
8870 - } else if ($this->email_exists($email)) {
8871 - $this->show_form(_('Email address already exists.'));
8872 - } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
8873 - !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
8874 - $this->show_form(_('Homepage is not a valid URL.'));
8876 - } else if (!is_null($fullname) && strlen($fullname) > 255) {
8877 - $this->show_form(_('Full name is too long (max 255 chars).'));
8879 - } else if (!is_null($bio) && strlen($bio) > 140) {
8880 - $this->show_form(_('Bio is too long (max 140 chars).'));
8882 - } else if (!is_null($location) && strlen($location) > 255) {
8883 - $this->show_form(_('Location is too long (max 255 chars).'));
8885 - } else if (strlen($password) < 6) {
8886 - $this->show_form(_('Password must be 6 or more characters.'));
8888 - } else if ($password != $confirm) {
8889 - $this->show_form(_('Passwords don\'t match.'));
8890 - } else if ($user = User::register(array('nickname' => $nickname, 'password' => $password, 'email' => $email,
8891 - 'fullname' => $fullname, 'homepage' => $homepage, 'bio' => $bio,
8892 - 'location' => $location, 'code' => $code))) {
8894 - $this->show_form(_('Invalid username or password.'));
8898 - if (!common_set_user($user)) {
8899 - common_server_error(_('Error setting user.'));
8902 - # this is a real login
8903 - common_real_login(true);
8904 - if ($this->boolean('rememberme')) {
8905 - common_debug('Adding rememberme cookie for ' . $nickname);
8906 - common_rememberme($user);
8908 - # Re-init language env in case it changed (not yet, but soon)
8909 - common_init_language();
8910 - $this->show_success();
8912 - $this->show_form(_('Invalid username or password.'));
8915 + if (!$this->boolean('license')) {
8916 + $this->show_form(_('You can\'t register if you don\'t agree to the license.'));
8917 + } else if ($email && !Validate::email($email, true)) {
8918 + $this->show_form(_('Not a valid email address.'));
8919 + } else if (!Validate::string($nickname, array('min_length' => 1,
8920 + 'max_length' => 64,
8921 + 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
8922 + $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
8923 + } else if ($this->nickname_exists($nickname)) {
8924 + $this->show_form(_('Nickname already in use. Try another one.'));
8925 + } else if (!User::allowed_nickname($nickname)) {
8926 + $this->show_form(_('Not a valid nickname.'));
8927 + } else if ($this->email_exists($email)) {
8928 + $this->show_form(_('Email address already exists.'));
8929 + } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
8930 + !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
8931 + $this->show_form(_('Homepage is not a valid URL.'));
8933 + } else if (!is_null($fullname) && strlen($fullname) > 255) {
8934 + $this->show_form(_('Full name is too long (max 255 chars).'));
8936 + } else if (!is_null($bio) && strlen($bio) > 140) {
8937 + $this->show_form(_('Bio is too long (max 140 chars).'));
8939 + } else if (!is_null($location) && strlen($location) > 255) {
8940 + $this->show_form(_('Location is too long (max 255 chars).'));
8942 + } else if (strlen($password) < 6) {
8943 + $this->show_form(_('Password must be 6 or more characters.'));
8945 + } else if ($password != $confirm) {
8946 + $this->show_form(_('Passwords don\'t match.'));
8947 + } else if ($user = User::register(array('nickname' => $nickname, 'password' => $password, 'email' => $email,
8948 + 'fullname' => $fullname, 'homepage' => $homepage, 'bio' => $bio,
8949 + 'location' => $location, 'code' => $code))) {
8951 + $this->show_form(_('Invalid username or password.'));
8955 + if (!common_set_user($user)) {
8956 + common_server_error(_('Error setting user.'));
8959 + # this is a real login
8960 + common_real_login(true);
8961 + if ($this->boolean('rememberme')) {
8962 + common_debug('Adding rememberme cookie for ' . $nickname);
8963 + common_rememberme($user);
8965 + # Re-init language env in case it changed (not yet, but soon)
8966 + common_init_language();
8967 + $this->show_success();
8969 + $this->show_form(_('Invalid username or password.'));
8972 hunk ./actions/register.php 134
8973 - # checks if *CANONICAL* nickname exists
8974 + # checks if *CANONICAL* nickname exists
8975 hunk ./actions/register.php 136
8976 - function nickname_exists($nickname) {
8977 - $user = User::staticGet('nickname', $nickname);
8978 - return ($user !== false);
8980 + function nickname_exists($nickname) {
8981 + $user = User::staticGet('nickname', $nickname);
8982 + return ($user !== false);
8984 hunk ./actions/register.php 141
8985 - # checks if *CANONICAL* email exists
8986 + # checks if *CANONICAL* email exists
8987 hunk ./actions/register.php 143
8988 - function email_exists($email) {
8989 - $email = common_canonical_email($email);
8990 - if (!$email || strlen($email) == 0) {
8993 - $user = User::staticGet('email', $email);
8994 - return ($user !== false);
8996 + function email_exists($email) {
8997 + $email = common_canonical_email($email);
8998 + if (!$email || strlen($email) == 0) {
9001 + $user = User::staticGet('email', $email);
9002 + return ($user !== false);
9004 hunk ./actions/register.php 152
9005 - function show_top($error=NULL) {
9007 - common_element('p', 'error', $error);
9009 - $instr = common_markup_to_html(_('With this form you can create a new account. ' .
9010 - 'You can then post notices and link up to friends and colleagues. '.
9011 - '(Have an [OpenID](http://openid.net/)? ' .
9012 - 'Try our [OpenID registration](%%action.openidlogin%%)!)'));
9013 + function show_top($error=NULL) {
9015 + common_element('p', 'error', $error);
9017 + $instr = common_markup_to_html(_('With this form you can create a new account. ' .
9018 + 'You can then post notices and link up to friends and colleagues. '.
9019 + '(Have an [OpenID](http://openid.net/)? ' .
9020 + 'Try our [OpenID registration](%%action.openidlogin%%)!)'));
9021 hunk ./actions/register.php 161
9022 - common_element_start('div', 'instructions');
9023 - common_raw($instr);
9024 - common_element_end('div');
9027 + common_element_start('div', 'instructions');
9028 + common_raw($instr);
9029 + common_element_end('div');
9032 hunk ./actions/register.php 167
9033 - function show_form($error=NULL) {
9035 + function show_form($error=NULL) {
9037 hunk ./actions/register.php 170
9038 - $code = $this->trimmed('code');
9039 + $code = $this->trimmed('code');
9040 hunk ./actions/register.php 172
9042 - $invite = Invitation::staticGet($code);
9045 + $invite = Invitation::staticGet($code);
9047 hunk ./actions/register.php 176
9048 - if (common_config('site', 'inviteonly') && !($code && $invite)) {
9049 - $this->client_error(_('Sorry, only invited people can register.'));
9052 + if (common_config('site', 'inviteonly') && !($code && $invite)) {
9053 + $this->client_error(_('Sorry, only invited people can register.'));
9056 hunk ./actions/register.php 181
9057 - common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
9058 - common_element_start('form', array('method' => 'post',
9060 - 'action' => common_local_url('register')));
9061 + common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
9062 + common_element_start('form', array('method' => 'post',
9064 + 'action' => common_local_url('register')));
9065 hunk ./actions/register.php 186
9066 - common_hidden('token', common_session_token());
9067 + common_hidden('token', common_session_token());
9068 hunk ./actions/register.php 188
9070 - common_hidden('code', $code);
9073 + common_hidden('code', $code);
9075 hunk ./actions/register.php 192
9076 - common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
9077 - _('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
9078 - common_password('password', _('Password'),
9079 - _('6 or more characters. Required.'));
9080 - common_password('confirm', _('Confirm'),
9081 - _('Same as password above. Required.'));
9082 - if ($invite && $invite->address_type == 'email') {
9083 - common_input('email', _('Email'), $invite->address,
9084 - _('Used only for updates, announcements, and password recovery'));
9086 - common_input('email', _('Email'), $this->trimmed('email'),
9087 - _('Used only for updates, announcements, and password recovery'));
9089 - common_input('fullname', _('Full name'),
9090 - $this->trimmed('fullname'),
9091 - _('Longer name, preferably your "real" name'));
9092 - common_input('homepage', _('Homepage'),
9093 - $this->trimmed('homepage'),
9094 - _('URL of your homepage, blog, or profile on another site'));
9095 - common_textarea('bio', _('Bio'),
9096 - $this->trimmed('bio'),
9097 - _('Describe yourself and your interests in 140 chars'));
9098 - common_input('location', _('Location'),
9099 - $this->trimmed('location'),
9100 - _('Where you are, like "City, State (or Region), Country"'));
9101 - common_checkbox('rememberme', _('Remember me'),
9102 - $this->boolean('rememberme'),
9103 - _('Automatically login in the future; not for shared computers!'));
9104 - common_element_start('p');
9105 - $attrs = array('type' => 'checkbox',
9106 - 'id' => 'license',
9107 - 'name' => 'license',
9108 - 'value' => 'true');
9109 - if ($this->boolean('license')) {
9110 - $attrs['checked'] = 'checked';
9112 - common_element('input', $attrs);
9113 - common_text(_('My text and files are available under '));
9114 - common_element('a', array('href' => $config['license']['url']),
9115 - $config['license']['title']);
9116 - common_text(_(' except this private data: password, email address, IM address, phone number.'));
9117 - common_element_end('p');
9118 - common_submit('submit', _('Register'));
9119 - common_element_end('form');
9120 - common_show_footer();
9122 + common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
9123 + _('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
9124 + common_password('password', _('Password'),
9125 + _('6 or more characters. Required.'));
9126 + common_password('confirm', _('Confirm'),
9127 + _('Same as password above. Required.'));
9128 + if ($invite && $invite->address_type == 'email') {
9129 + common_input('email', _('Email'), $invite->address,
9130 + _('Used only for updates, announcements, and password recovery'));
9132 + common_input('email', _('Email'), $this->trimmed('email'),
9133 + _('Used only for updates, announcements, and password recovery'));
9135 + common_input('fullname', _('Full name'),
9136 + $this->trimmed('fullname'),
9137 + _('Longer name, preferably your "real" name'));
9138 + common_input('homepage', _('Homepage'),
9139 + $this->trimmed('homepage'),
9140 + _('URL of your homepage, blog, or profile on another site'));
9141 + common_textarea('bio', _('Bio'),
9142 + $this->trimmed('bio'),
9143 + _('Describe yourself and your interests in 140 chars'));
9144 + common_input('location', _('Location'),
9145 + $this->trimmed('location'),
9146 + _('Where you are, like "City, State (or Region), Country"'));
9147 + common_checkbox('rememberme', _('Remember me'),
9148 + $this->boolean('rememberme'),
9149 + _('Automatically login in the future; not for shared computers!'));
9150 + common_element_start('p');
9151 + $attrs = array('type' => 'checkbox',
9152 + 'id' => 'license',
9153 + 'name' => 'license',
9154 + 'value' => 'true');
9155 + if ($this->boolean('license')) {
9156 + $attrs['checked'] = 'checked';
9158 + common_element('input', $attrs);
9159 + common_text(_('My text and files are available under '));
9160 + common_element('a', array('href' => $config['license']['url']),
9161 + $config['license']['title']);
9162 + common_text(_(' except this private data: password, email address, IM address, phone number.'));
9163 + common_element_end('p');
9164 + common_submit('submit', _('Register'));
9165 + common_element_end('form');
9166 + common_show_footer();
9168 hunk ./actions/register.php 239
9169 - function show_success() {
9170 - $nickname = $this->arg('nickname');
9171 - common_show_header(_('Registration successful'));
9172 - common_element_start('div', 'success');
9173 - $instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. From here, you may want to...'. "\n\n" .
9174 - '* Go to [your profile](%s) and post your first message.' . "\n" .
9175 - '* Add a [Jabber/GTalk address](%%%%action.imsettings%%%%) so you can send notices through instant messages.' . "\n" .
9176 - '* [Search for people](%%%%action.peoplesearch%%%%) that you may know or that share your interests. ' . "\n" .
9177 - '* Update your [profile settings](%%%%action.profilesettings%%%%) to tell others more about you. ' . "\n" .
9178 - '* Read over the [online docs](%%%%doc.help%%%%) for features you may have missed. ' . "\n\n" .
9179 - 'Thanks for signing up and we hope you enjoy using this service.'),
9180 - $nickname, common_local_url('showstream', array('nickname' => $nickname)));
9181 - common_raw(common_markup_to_html($instr));
9182 - $have_email = $this->trimmed('email');
9183 - if ($have_email) {
9184 - $emailinstr = _('(You should receive a message by email momentarily, with ' .
9185 - 'instructions on how to confirm your email address.)');
9186 - common_raw(common_markup_to_html($emailinstr));
9188 - common_element_end('div');
9189 - common_show_footer();
9191 + function show_success() {
9192 + $nickname = $this->arg('nickname');
9193 + common_show_header(_('Registration successful'));
9194 + common_element_start('div', 'success');
9195 + $instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. From here, you may want to...'. "\n\n" .
9196 + '* Go to [your profile](%s) and post your first message.' . "\n" .
9197 + '* Add a [Jabber/GTalk address](%%%%action.imsettings%%%%) so you can send notices through instant messages.' . "\n" .
9198 + '* [Search for people](%%%%action.peoplesearch%%%%) that you may know or that share your interests. ' . "\n" .
9199 + '* Update your [profile settings](%%%%action.profilesettings%%%%) to tell others more about you. ' . "\n" .
9200 + '* Read over the [online docs](%%%%doc.help%%%%) for features you may have missed. ' . "\n\n" .
9201 + 'Thanks for signing up and we hope you enjoy using this service.'),
9202 + $nickname, common_local_url('showstream', array('nickname' => $nickname)));
9203 + common_raw(common_markup_to_html($instr));
9204 + $have_email = $this->trimmed('email');
9205 + if ($have_email) {
9206 + $emailinstr = _('(You should receive a message by email momentarily, with ' .
9207 + 'instructions on how to confirm your email address.)');
9208 + common_raw(common_markup_to_html($emailinstr));
9210 + common_element_end('div');
9211 + common_show_footer();
9213 hunk ./actions/remotesubscribe.php 26
9214 - function handle($args) {
9215 + function handle($args) {
9216 hunk ./actions/remotesubscribe.php 28
9217 - parent::handle($args);
9218 + parent::handle($args);
9219 hunk ./actions/remotesubscribe.php 30
9220 - if (common_logged_in()) {
9221 - common_user_error(_('You can use the local subscription!'));
9224 + if (common_logged_in()) {
9225 + common_user_error(_('You can use the local subscription!'));
9228 hunk ./actions/remotesubscribe.php 35
9229 - if ($_SERVER['REQUEST_METHOD'] == 'POST') {
9230 + if ($_SERVER['REQUEST_METHOD'] == 'POST') {
9231 hunk ./actions/remotesubscribe.php 37
9233 - $token = $this->trimmed('token');
9234 - if (!$token || $token != common_session_token()) {
9235 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
9239 + $token = $this->trimmed('token');
9240 + if (!$token || $token != common_session_token()) {
9241 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
9244 hunk ./actions/remotesubscribe.php 44
9245 - $this->remote_subscription();
9247 - $this->show_form();
9250 + $this->remote_subscription();
9252 + $this->show_form();
9255 hunk ./actions/remotesubscribe.php 50
9256 - function get_instructions() {
9257 - return _('To subscribe, you can [login](%%action.login%%),' .
9258 - ' or [register](%%action.register%%) a new ' .
9259 - ' account. If you already have an account ' .
9260 - ' on a [compatible microblogging site](%%doc.openmublog%%), ' .
9261 - ' enter your profile URL below.');
9263 + function get_instructions() {
9264 + return _('To subscribe, you can [login](%%action.login%%),' .
9265 + ' or [register](%%action.register%%) a new ' .
9266 + ' account. If you already have an account ' .
9267 + ' on a [compatible microblogging site](%%doc.openmublog%%), ' .
9268 + ' enter your profile URL below.');
9270 hunk ./actions/remotesubscribe.php 58
9271 - function show_top($err=NULL) {
9273 - common_element('div', 'error', $err);
9275 - $instructions = $this->get_instructions();
9276 - $output = common_markup_to_html($instructions);
9277 - common_element_start('div', 'instructions');
9278 - common_raw($output);
9279 - common_element_end('p');
9282 + function show_top($err=NULL) {
9284 + common_element('div', 'error', $err);
9286 + $instructions = $this->get_instructions();
9287 + $output = common_markup_to_html($instructions);
9288 + common_element_start('div', 'instructions');
9289 + common_raw($output);
9290 + common_element_end('p');
9293 hunk ./actions/remotesubscribe.php 70
9294 - function show_form($err=NULL) {
9295 - $nickname = $this->trimmed('nickname');
9296 - $profile = $this->trimmed('profile_url');
9297 - common_show_header(_('Remote subscribe'), NULL, $err,
9298 - array($this, 'show_top'));
9299 - # id = remotesubscribe conflicts with the
9300 - # button on profile page
9301 - common_element_start('form', array('id' => 'remsub', 'method' => 'post',
9302 - 'action' => common_local_url('remotesubscribe')));
9303 - common_hidden('token', common_session_token());
9304 - common_input('nickname', _('User nickname'), $nickname,
9305 - _('Nickname of the user you want to follow'));
9306 - common_input('profile_url', _('Profile URL'), $profile,
9307 - _('URL of your profile on another compatible microblogging service'));
9308 - common_submit('submit', _('Subscribe'));
9309 - common_element_end('form');
9310 - common_show_footer();
9312 + function show_form($err=NULL) {
9313 + $nickname = $this->trimmed('nickname');
9314 + $profile = $this->trimmed('profile_url');
9315 + common_show_header(_('Remote subscribe'), NULL, $err,
9316 + array($this, 'show_top'));
9317 + # id = remotesubscribe conflicts with the
9318 + # button on profile page
9319 + common_element_start('form', array('id' => 'remsub', 'method' => 'post',
9320 + 'action' => common_local_url('remotesubscribe')));
9321 + common_hidden('token', common_session_token());
9322 + common_input('nickname', _('User nickname'), $nickname,
9323 + _('Nickname of the user you want to follow'));
9324 + common_input('profile_url', _('Profile URL'), $profile,
9325 + _('URL of your profile on another compatible microblogging service'));
9326 + common_submit('submit', _('Subscribe'));
9327 + common_element_end('form');
9328 + common_show_footer();
9330 hunk ./actions/remotesubscribe.php 89
9331 - function remote_subscription() {
9332 - $user = $this->get_user();
9333 + function remote_subscription() {
9334 + $user = $this->get_user();
9335 hunk ./actions/remotesubscribe.php 92
9337 - $this->show_form(_('No such user.'));
9341 + $this->show_form(_('No such user.'));
9344 hunk ./actions/remotesubscribe.php 97
9345 - $profile = $this->trimmed('profile_url');
9346 + $profile = $this->trimmed('profile_url');
9347 hunk ./actions/remotesubscribe.php 99
9349 - $this->show_form(_('No such user.'));
9353 + $this->show_form(_('No such user.'));
9356 hunk ./actions/remotesubscribe.php 104
9357 - if (!Validate::uri($profile, array('allowed_schemes' => array('http', 'https')))) {
9358 - $this->show_form(_('Invalid profile URL (bad format)'));
9361 + if (!Validate::uri($profile, array('allowed_schemes' => array('http', 'https')))) {
9362 + $this->show_form(_('Invalid profile URL (bad format)'));
9365 hunk ./actions/remotesubscribe.php 109
9366 - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
9367 - $yadis = Auth_Yadis_Yadis::discover($profile, $fetcher);
9368 + $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
9369 + $yadis = Auth_Yadis_Yadis::discover($profile, $fetcher);
9370 hunk ./actions/remotesubscribe.php 112
9371 - if (!$yadis || $yadis->failed) {
9372 - $this->show_form(_('Not a valid profile URL (no YADIS document).'));
9375 + if (!$yadis || $yadis->failed) {
9376 + $this->show_form(_('Not a valid profile URL (no YADIS document).'));
9379 hunk ./actions/remotesubscribe.php 117
9380 - # XXX: a little liberal for sites that accidentally put whitespace before the xml declaration
9381 + # XXX: a little liberal for sites that accidentally put whitespace before the xml declaration
9382 hunk ./actions/remotesubscribe.php 121
9384 - $this->show_form(_('Not a valid profile URL (no XRDS defined).'));
9388 + $this->show_form(_('Not a valid profile URL (no XRDS defined).'));
9391 hunk ./actions/remotesubscribe.php 126
9392 - $omb = $this->getOmb($xrds);
9393 + $omb = $this->getOmb($xrds);
9394 hunk ./actions/remotesubscribe.php 128
9396 - $this->show_form(_('Not a valid profile URL (incorrect services).'));
9400 + $this->show_form(_('Not a valid profile URL (incorrect services).'));
9403 hunk ./actions/remotesubscribe.php 133
9404 - if (omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]) ==
9405 - common_local_url('requesttoken'))
9407 - $this->show_form(_('That\'s a local profile! Login to subscribe.'));
9410 + if (omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]) ==
9411 + common_local_url('requesttoken'))
9413 + $this->show_form(_('That\'s a local profile! Login to subscribe.'));
9416 hunk ./actions/remotesubscribe.php 140
9417 - if (User::staticGet('uri', omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]))) {
9418 - $this->show_form(_('That\'s a local profile! Login to subscribe.'));
9421 + if (User::staticGet('uri', omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]))) {
9422 + $this->show_form(_('That\'s a local profile! Login to subscribe.'));
9425 hunk ./actions/remotesubscribe.php 145
9426 - list($token, $secret) = $this->request_token($omb);
9427 + list($token, $secret) = $this->request_token($omb);
9428 hunk ./actions/remotesubscribe.php 147
9429 - if (!$token || !$secret) {
9430 - $this->show_form(_('Couldn\'t get a request token.'));
9433 + if (!$token || !$secret) {
9434 + $this->show_form(_('Couldn\'t get a request token.'));
9437 hunk ./actions/remotesubscribe.php 152
9438 - $this->request_authorization($user, $omb, $token, $secret);
9440 + $this->request_authorization($user, $omb, $token, $secret);
9442 hunk ./actions/remotesubscribe.php 155
9443 - function get_user() {
9445 - $nickname = $this->trimmed('nickname');
9447 - $user = User::staticGet('nickname', $nickname);
9451 + function get_user() {
9453 + $nickname = $this->trimmed('nickname');
9455 + $user = User::staticGet('nickname', $nickname);
9459 hunk ./actions/remotesubscribe.php 164
9460 - function getOmb($xrds) {
9461 + function getOmb($xrds) {
9462 hunk ./actions/remotesubscribe.php 166
9463 - static $omb_endpoints = array(OMB_ENDPOINT_UPDATEPROFILE, OMB_ENDPOINT_POSTNOTICE);
9464 - static $oauth_endpoints = array(OAUTH_ENDPOINT_REQUEST, OAUTH_ENDPOINT_AUTHORIZE,
9465 - OAUTH_ENDPOINT_ACCESS);
9467 + static $omb_endpoints = array(OMB_ENDPOINT_UPDATEPROFILE, OMB_ENDPOINT_POSTNOTICE);
9468 + static $oauth_endpoints = array(OAUTH_ENDPOINT_REQUEST, OAUTH_ENDPOINT_AUTHORIZE,
9469 + OAUTH_ENDPOINT_ACCESS);
9471 hunk ./actions/remotesubscribe.php 171
9472 - # XXX: the following code could probably be refactored to eliminate dupes
9473 + # XXX: the following code could probably be refactored to eliminate dupes
9474 hunk ./actions/remotesubscribe.php 173
9475 - $oauth_services = omb_get_services($xrds, OAUTH_DISCOVERY);
9476 + $oauth_services = omb_get_services($xrds, OAUTH_DISCOVERY);
9477 hunk ./actions/remotesubscribe.php 175
9478 - if (!$oauth_services) {
9481 + if (!$oauth_services) {
9484 hunk ./actions/remotesubscribe.php 179
9485 - $oauth_service = $oauth_services[0];
9486 + $oauth_service = $oauth_services[0];
9487 hunk ./actions/remotesubscribe.php 181
9488 - $oauth_xrd = $this->getXRD($oauth_service, $xrds);
9489 + $oauth_xrd = $this->getXRD($oauth_service, $xrds);
9490 hunk ./actions/remotesubscribe.php 183
9491 - if (!$oauth_xrd) {
9494 + if (!$oauth_xrd) {
9497 hunk ./actions/remotesubscribe.php 187
9498 - if (!$this->addServices($oauth_xrd, $oauth_endpoints, $omb)) {
9501 + if (!$this->addServices($oauth_xrd, $oauth_endpoints, $omb)) {
9504 hunk ./actions/remotesubscribe.php 191
9505 - $omb_services = omb_get_services($xrds, OMB_NAMESPACE);
9506 + $omb_services = omb_get_services($xrds, OMB_NAMESPACE);
9507 hunk ./actions/remotesubscribe.php 193
9508 - if (!$omb_services) {
9511 + if (!$omb_services) {
9514 hunk ./actions/remotesubscribe.php 197
9515 - $omb_service = $omb_services[0];
9516 + $omb_service = $omb_services[0];
9517 hunk ./actions/remotesubscribe.php 199
9518 - $omb_xrd = $this->getXRD($omb_service, $xrds);
9519 + $omb_xrd = $this->getXRD($omb_service, $xrds);
9520 hunk ./actions/remotesubscribe.php 201
9527 hunk ./actions/remotesubscribe.php 205
9528 - if (!$this->addServices($omb_xrd, $omb_endpoints, $omb)) {
9531 + if (!$this->addServices($omb_xrd, $omb_endpoints, $omb)) {
9534 hunk ./actions/remotesubscribe.php 209
9535 - # XXX: check that we got all the services we needed
9536 + # XXX: check that we got all the services we needed
9537 hunk ./actions/remotesubscribe.php 211
9538 - foreach (array_merge($omb_endpoints, $oauth_endpoints) as $type) {
9539 - if (!array_key_exists($type, $omb) || !$omb[$type]) {
9543 + foreach (array_merge($omb_endpoints, $oauth_endpoints) as $type) {
9544 + if (!array_key_exists($type, $omb) || !$omb[$type]) {
9548 hunk ./actions/remotesubscribe.php 217
9549 - if (!omb_local_id($omb[OAUTH_ENDPOINT_REQUEST])) {
9552 + if (!omb_local_id($omb[OAUTH_ENDPOINT_REQUEST])) {
9555 hunk ./actions/remotesubscribe.php 221
9560 hunk ./actions/remotesubscribe.php 224
9561 - function getXRD($main_service, $main_xrds) {
9562 - $uri = omb_service_uri($main_service);
9563 - if (strpos($uri, "#") !== 0) {
9564 - # FIXME: more rigorous handling of external service definitions
9567 - $id = substr($uri, 1);
9568 - $nodes = $main_xrds->allXrdNodes;
9569 - $parser = $main_xrds->parser;
9570 - foreach ($nodes as $node) {
9571 - $attrs = $parser->attributes($node);
9572 - if (array_key_exists('xml:id', $attrs) &&
9573 - $attrs['xml:id'] == $id) {
9574 - # XXX: trick the constructor into thinking this is the only node
9575 - $bogus_nodes = array($node);
9576 - return new Auth_Yadis_XRDS($parser, $bogus_nodes);
9581 + function getXRD($main_service, $main_xrds) {
9582 + $uri = omb_service_uri($main_service);
9583 + if (strpos($uri, "#") !== 0) {
9584 + # FIXME: more rigorous handling of external service definitions
9587 + $id = substr($uri, 1);
9588 + $nodes = $main_xrds->allXrdNodes;
9589 + $parser = $main_xrds->parser;
9590 + foreach ($nodes as $node) {
9591 + $attrs = $parser->attributes($node);
9592 + if (array_key_exists('xml:id', $attrs) &&
9593 + $attrs['xml:id'] == $id) {
9594 + # XXX: trick the constructor into thinking this is the only node
9595 + $bogus_nodes = array($node);
9596 + return new Auth_Yadis_XRDS($parser, $bogus_nodes);
9601 hunk ./actions/remotesubscribe.php 245
9602 - function addServices($xrd, $types, &$omb) {
9603 - foreach ($types as $type) {
9604 - $matches = omb_get_services($xrd, $type);
9606 - $omb[$type] = $matches[0];
9608 - # no match for type
9614 + function addServices($xrd, $types, &$omb) {
9615 + foreach ($types as $type) {
9616 + $matches = omb_get_services($xrd, $type);
9618 + $omb[$type] = $matches[0];
9620 + # no match for type
9626 hunk ./actions/remotesubscribe.php 258
9627 - function request_token($omb) {
9628 - $con = omb_oauth_consumer();
9629 + function request_token($omb) {
9630 + $con = omb_oauth_consumer();
9631 hunk ./actions/remotesubscribe.php 261
9632 - $url = omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]);
9633 + $url = omb_service_uri($omb[OAUTH_ENDPOINT_REQUEST]);
9634 hunk ./actions/remotesubscribe.php 263
9635 - # XXX: Is this the right thing to do? Strip off GET params and make them
9636 - # POST params? Seems wrong to me.
9637 + # XXX: Is this the right thing to do? Strip off GET params and make them
9638 + # POST params? Seems wrong to me.
9639 hunk ./actions/remotesubscribe.php 266
9640 - $parsed = parse_url($url);
9641 - $params = array();
9642 - parse_str($parsed['query'], $params);
9643 + $parsed = parse_url($url);
9644 + $params = array();
9645 + parse_str($parsed['query'], $params);
9646 hunk ./actions/remotesubscribe.php 270
9647 - $req = OAuthRequest::from_consumer_and_token($con, NULL, "POST", $url, $params);
9648 + $req = OAuthRequest::from_consumer_and_token($con, NULL, "POST", $url, $params);
9649 hunk ./actions/remotesubscribe.php 272
9650 - $listener = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
9651 + $listener = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
9652 hunk ./actions/remotesubscribe.php 274
9659 hunk ./actions/remotesubscribe.php 278
9660 - $req->set_parameter('omb_listener', $listener);
9661 - $req->set_parameter('omb_version', OMB_VERSION_01);
9662 + $req->set_parameter('omb_listener', $listener);
9663 + $req->set_parameter('omb_version', OMB_VERSION_01);
9664 hunk ./actions/remotesubscribe.php 281
9665 - # XXX: test to see if endpoint accepts this signature method
9666 + # XXX: test to see if endpoint accepts this signature method
9667 hunk ./actions/remotesubscribe.php 283
9668 - $req->sign_request(omb_hmac_sha1(), $con, NULL);
9669 + $req->sign_request(omb_hmac_sha1(), $con, NULL);
9670 hunk ./actions/remotesubscribe.php 285
9671 - # We re-use this tool's fetcher, since it's pretty good
9672 + # We re-use this tool's fetcher, since it's pretty good
9673 hunk ./actions/remotesubscribe.php 287
9674 - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
9675 + $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
9676 hunk ./actions/remotesubscribe.php 289
9677 - $result = $fetcher->post($req->get_normalized_http_url(),
9678 - $req->to_postdata(),
9679 + $result = $fetcher->post($req->get_normalized_http_url(),
9680 + $req->to_postdata(),
9681 hunk ./actions/remotesubscribe.php 293
9682 - if ($result->status != 200) {
9685 + if ($result->status != 200) {
9688 hunk ./actions/remotesubscribe.php 297
9689 - parse_str($result->body, $return);
9690 + parse_str($result->body, $return);
9691 hunk ./actions/remotesubscribe.php 299
9692 - return array($return['oauth_token'], $return['oauth_token_secret']);
9694 + return array($return['oauth_token'], $return['oauth_token_secret']);
9696 hunk ./actions/remotesubscribe.php 302
9697 - function request_authorization($user, $omb, $token, $secret) {
9698 - global $config; # for license URL
9699 + function request_authorization($user, $omb, $token, $secret) {
9700 + global $config; # for license URL
9701 hunk ./actions/remotesubscribe.php 305
9702 - $con = omb_oauth_consumer();
9703 - $tok = new OAuthToken($token, $secret);
9704 + $con = omb_oauth_consumer();
9705 + $tok = new OAuthToken($token, $secret);
9706 hunk ./actions/remotesubscribe.php 308
9707 - $url = omb_service_uri($omb[OAUTH_ENDPOINT_AUTHORIZE]);
9708 + $url = omb_service_uri($omb[OAUTH_ENDPOINT_AUTHORIZE]);
9709 hunk ./actions/remotesubscribe.php 310
9710 - # XXX: Is this the right thing to do? Strip off GET params and make them
9711 - # POST params? Seems wrong to me.
9712 + # XXX: Is this the right thing to do? Strip off GET params and make them
9713 + # POST params? Seems wrong to me.
9714 hunk ./actions/remotesubscribe.php 313
9715 - $parsed = parse_url($url);
9716 - $params = array();
9717 - parse_str($parsed['query'], $params);
9718 + $parsed = parse_url($url);
9719 + $params = array();
9720 + parse_str($parsed['query'], $params);
9721 hunk ./actions/remotesubscribe.php 317
9722 - $req = OAuthRequest::from_consumer_and_token($con, $tok, 'GET', $url, $params);
9723 + $req = OAuthRequest::from_consumer_and_token($con, $tok, 'GET', $url, $params);
9724 hunk ./actions/remotesubscribe.php 319
9725 - # We send over a ton of information. This lets the other
9726 - # server store info about our user, and it lets the current
9727 - # user decide if they really want to authorize the subscription.
9728 + # We send over a ton of information. This lets the other
9729 + # server store info about our user, and it lets the current
9730 + # user decide if they really want to authorize the subscription.
9731 hunk ./actions/remotesubscribe.php 323
9732 - $req->set_parameter('omb_version', OMB_VERSION_01);
9733 - $req->set_parameter('omb_listener', omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]));
9734 - $req->set_parameter('omb_listenee', $user->uri);
9735 - $req->set_parameter('omb_listenee_profile', common_profile_url($user->nickname));
9736 - $req->set_parameter('omb_listenee_nickname', $user->nickname);
9737 - $req->set_parameter('omb_listenee_license', $config['license']['url']);
9738 + $req->set_parameter('omb_version', OMB_VERSION_01);
9739 + $req->set_parameter('omb_listener', omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]));
9740 + $req->set_parameter('omb_listenee', $user->uri);
9741 + $req->set_parameter('omb_listenee_profile', common_profile_url($user->nickname));
9742 + $req->set_parameter('omb_listenee_nickname', $user->nickname);
9743 + $req->set_parameter('omb_listenee_license', $config['license']['url']);
9744 hunk ./actions/remotesubscribe.php 330
9745 - $profile = $user->getProfile();
9747 - common_log_db_error($user, 'SELECT', __FILE__);
9748 - $this->server_error(_('User without matching profile'));
9751 + $profile = $user->getProfile();
9753 + common_log_db_error($user, 'SELECT', __FILE__);
9754 + $this->server_error(_('User without matching profile'));
9757 hunk ./actions/remotesubscribe.php 337
9758 - if ($profile->fullname) {
9759 - $req->set_parameter('omb_listenee_fullname', $profile->fullname);
9761 - if ($profile->homepage) {
9762 - $req->set_parameter('omb_listenee_homepage', $profile->homepage);
9764 - if ($profile->bio) {
9765 - $req->set_parameter('omb_listenee_bio', $profile->bio);
9767 - if ($profile->location) {
9768 - $req->set_parameter('omb_listenee_location', $profile->location);
9770 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
9772 - $req->set_parameter('omb_listenee_avatar', $avatar->url);
9774 + if ($profile->fullname) {
9775 + $req->set_parameter('omb_listenee_fullname', $profile->fullname);
9777 + if ($profile->homepage) {
9778 + $req->set_parameter('omb_listenee_homepage', $profile->homepage);
9780 + if ($profile->bio) {
9781 + $req->set_parameter('omb_listenee_bio', $profile->bio);
9783 + if ($profile->location) {
9784 + $req->set_parameter('omb_listenee_location', $profile->location);
9786 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
9788 + $req->set_parameter('omb_listenee_avatar', $avatar->url);
9790 hunk ./actions/remotesubscribe.php 354
9791 - # XXX: add a nonce to prevent replay attacks
9792 + # XXX: add a nonce to prevent replay attacks
9793 hunk ./actions/remotesubscribe.php 356
9794 - $req->set_parameter('oauth_callback', common_local_url('finishremotesubscribe'));
9795 + $req->set_parameter('oauth_callback', common_local_url('finishremotesubscribe'));
9796 hunk ./actions/remotesubscribe.php 358
9797 - # XXX: test to see if endpoint accepts this signature method
9798 + # XXX: test to see if endpoint accepts this signature method
9799 hunk ./actions/remotesubscribe.php 360
9800 - $req->sign_request(omb_hmac_sha1(), $con, $tok);
9801 + $req->sign_request(omb_hmac_sha1(), $con, $tok);
9802 hunk ./actions/remotesubscribe.php 362
9803 - # store all our info here
9804 + # store all our info here
9805 hunk ./actions/remotesubscribe.php 364
9806 - $omb['listenee'] = $user->nickname;
9807 - $omb['listener'] = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
9808 - $omb['token'] = $token;
9809 - $omb['secret'] = $secret;
9810 - # call doesn't work after bounce back so we cache; maybe serialization issue...?
9811 - $omb['access_token_url'] = omb_service_uri($omb[OAUTH_ENDPOINT_ACCESS]);
9812 - $omb['post_notice_url'] = omb_service_uri($omb[OMB_ENDPOINT_POSTNOTICE]);
9813 - $omb['update_profile_url'] = omb_service_uri($omb[OMB_ENDPOINT_UPDATEPROFILE]);
9814 + $omb['listenee'] = $user->nickname;
9815 + $omb['listener'] = omb_local_id($omb[OAUTH_ENDPOINT_REQUEST]);
9816 + $omb['token'] = $token;
9817 + $omb['secret'] = $secret;
9818 + # call doesn't work after bounce back so we cache; maybe serialization issue...?
9819 + $omb['access_token_url'] = omb_service_uri($omb[OAUTH_ENDPOINT_ACCESS]);
9820 + $omb['post_notice_url'] = omb_service_uri($omb[OMB_ENDPOINT_POSTNOTICE]);
9821 + $omb['update_profile_url'] = omb_service_uri($omb[OMB_ENDPOINT_UPDATEPROFILE]);
9822 hunk ./actions/remotesubscribe.php 373
9823 - common_ensure_session();
9824 + common_ensure_session();
9825 hunk ./actions/remotesubscribe.php 375
9826 - $_SESSION['oauth_authorization_request'] = $omb;
9827 + $_SESSION['oauth_authorization_request'] = $omb;
9828 hunk ./actions/remotesubscribe.php 377
9829 - # Redirect to authorization service
9830 + # Redirect to authorization service
9831 hunk ./actions/remotesubscribe.php 379
9832 - common_redirect($req->to_url());
9835 + common_redirect($req->to_url());
9838 hunk ./actions/remotesubscribe.php 383
9839 - function make_nonce() {
9840 - return common_good_rand(16);
9842 + function make_nonce() {
9843 + return common_good_rand(16);
9845 hunk ./actions/replies.php 26
9846 - function handle($args) {
9847 + function handle($args) {
9848 hunk ./actions/replies.php 28
9849 - parent::handle($args);
9850 + parent::handle($args);
9851 hunk ./actions/replies.php 30
9852 - $nickname = common_canonical_nickname($this->arg('nickname'));
9853 - $user = User::staticGet('nickname', $nickname);
9854 + $nickname = common_canonical_nickname($this->arg('nickname'));
9855 + $user = User::staticGet('nickname', $nickname);
9856 hunk ./actions/replies.php 33
9858 - $this->no_such_user();
9862 + $this->no_such_user();
9865 hunk ./actions/replies.php 38
9866 - $profile = $user->getProfile();
9867 + $profile = $user->getProfile();
9868 hunk ./actions/replies.php 40
9870 - common_server_error(_('User has no profile.'));
9874 + common_server_error(_('User has no profile.'));
9877 hunk ./actions/replies.php 45
9878 - # Looks like we're good; show the header
9879 + # Looks like we're good; show the header
9880 hunk ./actions/replies.php 47
9881 - common_show_header(sprintf(_("Replies to %s"), $profile->nickname),
9882 - array($this, 'show_header'), $user,
9883 - array($this, 'show_top'));
9884 + common_show_header(sprintf(_("Replies to %s"), $profile->nickname),
9885 + array($this, 'show_header'), $user,
9886 + array($this, 'show_top'));
9887 hunk ./actions/replies.php 51
9888 - $this->show_replies($user);
9889 + $this->show_replies($user);
9890 hunk ./actions/replies.php 53
9891 - common_show_footer();
9893 + common_show_footer();
9895 hunk ./actions/replies.php 56
9896 - function no_such_user() {
9897 - common_user_error(_('No such user.'));
9899 + function no_such_user() {
9900 + common_user_error(_('No such user.'));
9902 hunk ./actions/replies.php 60
9903 - function show_header($user) {
9904 - common_element('link', array('rel' => 'alternate',
9905 - 'href' => common_local_url('repliesrss', array('nickname' =>
9906 - $user->nickname)),
9907 - 'type' => 'application/rss+xml',
9908 - 'title' => sprintf(_('Feed for replies to %s'), $user->nickname)));
9910 + function show_header($user) {
9911 + common_element('link', array('rel' => 'alternate',
9912 + 'href' => common_local_url('repliesrss', array('nickname' =>
9913 + $user->nickname)),
9914 + 'type' => 'application/rss+xml',
9915 + 'title' => sprintf(_('Feed for replies to %s'), $user->nickname)));
9917 hunk ./actions/replies.php 68
9918 - function show_top($user) {
9919 - $cur = common_current_user();
9920 + function show_top($user) {
9921 + $cur = common_current_user();
9922 hunk ./actions/replies.php 71
9923 - if ($cur && $cur->id == $user->id) {
9924 - common_notice_form('replies');
9926 + if ($cur && $cur->id == $user->id) {
9927 + common_notice_form('replies');
9929 hunk ./actions/replies.php 75
9930 - $this->views_menu();
9931 + $this->views_menu();
9932 hunk ./actions/replies.php 77
9933 - $this->show_feeds_list(array(0=>array('href'=>common_local_url('repliesrss', array('nickname' => $user->nickname)),
9935 - 'version' => 'RSS 1.0',
9936 - 'item' => 'repliesrss')));
9938 + $this->show_feeds_list(array(0=>array('href'=>common_local_url('repliesrss', array('nickname' => $user->nickname)),
9940 + 'version' => 'RSS 1.0',
9941 + 'item' => 'repliesrss')));
9943 hunk ./actions/replies.php 83
9944 - function show_replies($user) {
9945 + function show_replies($user) {
9946 hunk ./actions/replies.php 85
9947 - $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
9948 + $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
9949 hunk ./actions/replies.php 87
9950 - $notice = $user->getReplies(($page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
9951 + $notice = $user->getReplies(($page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
9952 hunk ./actions/replies.php 89
9953 - $cnt = $this->show_notice_list($notice);
9954 + $cnt = $this->show_notice_list($notice);
9955 hunk ./actions/replies.php 91
9956 - common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
9957 - $page, 'replies', array('nickname' => $user->nickname));
9959 + common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
9960 + $page, 'replies', array('nickname' => $user->nickname));
9962 hunk ./actions/repliesrss.php 28
9965 hunk ./actions/repliesrss.php 30
9967 - $nickname = $this->trimmed('nickname');
9968 - $this->user = User::staticGet('nickname', $nickname);
9970 + $nickname = $this->trimmed('nickname');
9971 + $this->user = User::staticGet('nickname', $nickname);
9972 hunk ./actions/repliesrss.php 34
9973 - if (!$this->user) {
9974 - common_user_error(_('No such user.'));
9980 + if (!$this->user) {
9981 + common_user_error(_('No such user.'));
9987 hunk ./actions/repliesrss.php 42
9988 - function get_notices($limit=0) {
9989 + function get_notices($limit=0) {
9990 hunk ./actions/repliesrss.php 44
9991 - $user = $this->user;
9992 + $user = $this->user;
9993 hunk ./actions/repliesrss.php 46
9994 - $notice = $user->getReplies(0, ($limit == 0) ? 48 : $limit);
9995 + $notice = $user->getReplies(0, ($limit == 0) ? 48 : $limit);
9996 hunk ./actions/repliesrss.php 48
9997 - $notices = array();
9999 - while ($notice->fetch()) {
10000 - $notices[] = clone($notice);
10002 + $notices = array();
10004 + while ($notice->fetch()) {
10005 + $notices[] = clone($notice);
10007 hunk ./actions/repliesrss.php 54
10012 hunk ./actions/repliesrss.php 57
10013 - function get_channel() {
10014 - $user = $this->user;
10015 - $c = array('url' => common_local_url('repliesrss',
10016 - array('nickname' =>
10017 - $user->nickname)),
10018 - 'title' => sprintf(_("Replies to %s"), $user->nickname),
10019 - 'link' => common_local_url('replies',
10020 - array('nickname' =>
10021 - $user->nickname)),
10022 - 'description' => sprintf(_('Feed for replies to %s'), $user->nickname));
10025 + function get_channel() {
10026 + $user = $this->user;
10027 + $c = array('url' => common_local_url('repliesrss',
10028 + array('nickname' =>
10029 + $user->nickname)),
10030 + 'title' => sprintf(_("Replies to %s"), $user->nickname),
10031 + 'link' => common_local_url('replies',
10032 + array('nickname' =>
10033 + $user->nickname)),
10034 + 'description' => sprintf(_('Feed for replies to %s'), $user->nickname));
10037 hunk ./actions/repliesrss.php 70
10038 - function get_image() {
10039 - $user = $this->user;
10040 - $profile = $user->getProfile();
10044 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
10045 - return ($avatar) ? $avatar->url : NULL;
10047 + function get_image() {
10048 + $user = $this->user;
10049 + $profile = $user->getProfile();
10053 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
10054 + return ($avatar) ? $avatar->url : NULL;
10056 hunk ./actions/requesttoken.php 25
10058 - function is_readonly() {
10062 - function handle($args) {
10063 - parent::handle($args);
10065 - common_remove_magic_from_request();
10066 - $req = OAuthRequest::from_request();
10067 - $server = omb_oauth_server();
10068 - $token = $server->fetch_request_token($req);
10070 - } catch (OAuthException $e) {
10071 - common_server_error($e->getMessage());
10075 + function is_readonly() {
10079 + function handle($args) {
10080 + parent::handle($args);
10082 + common_remove_magic_from_request();
10083 + $req = OAuthRequest::from_request();
10084 + $server = omb_oauth_server();
10085 + $token = $server->fetch_request_token($req);
10087 + } catch (OAuthException $e) {
10088 + common_server_error($e->getMessage());
10091 hunk ./actions/showfavorites.php 26
10092 - function handle($args) {
10093 + function handle($args) {
10094 hunk ./actions/showfavorites.php 28
10095 - parent::handle($args);
10096 + parent::handle($args);
10097 hunk ./actions/showfavorites.php 30
10098 - $nickname = common_canonical_nickname($this->arg('nickname'));
10099 - $user = User::staticGet('nickname', $nickname);
10100 + $nickname = common_canonical_nickname($this->arg('nickname'));
10101 + $user = User::staticGet('nickname', $nickname);
10102 hunk ./actions/showfavorites.php 33
10104 - $this->client_error(_('No such user.'));
10108 + $this->client_error(_('No such user.'));
10111 hunk ./actions/showfavorites.php 38
10112 - $profile = $user->getProfile();
10113 + $profile = $user->getProfile();
10114 hunk ./actions/showfavorites.php 40
10116 - common_server_error(_('User has no profile.'));
10120 + common_server_error(_('User has no profile.'));
10123 hunk ./actions/showfavorites.php 45
10124 - # Looks like we're good; show the header
10125 + # Looks like we're good; show the header
10126 hunk ./actions/showfavorites.php 47
10127 - common_show_header(sprintf(_("%s favorite notices"), $profile->nickname),
10128 - array($this, 'show_header'), $user,
10129 - array($this, 'show_top'));
10130 + common_show_header(sprintf(_("%s favorite notices"), $profile->nickname),
10131 + array($this, 'show_header'), $user,
10132 + array($this, 'show_top'));
10133 hunk ./actions/showfavorites.php 51
10134 - $this->show_notices($user);
10135 + $this->show_notices($user);
10136 hunk ./actions/showfavorites.php 53
10137 - common_show_footer();
10139 + common_show_footer();
10141 hunk ./actions/showfavorites.php 56
10142 - function show_header($user) {
10143 - common_element('link', array('rel' => 'alternate',
10144 - 'href' => common_local_url('favoritesrss', array('nickname' =>
10145 - $user->nickname)),
10146 - 'type' => 'application/rss+xml',
10147 - 'title' => sprintf(_('Feed for favorites of %s'), $user->nickname)));
10149 + function show_header($user) {
10150 + common_element('link', array('rel' => 'alternate',
10151 + 'href' => common_local_url('favoritesrss', array('nickname' =>
10152 + $user->nickname)),
10153 + 'type' => 'application/rss+xml',
10154 + 'title' => sprintf(_('Feed for favorites of %s'), $user->nickname)));
10156 hunk ./actions/showfavorites.php 64
10157 - function show_top($user) {
10158 - $cur = common_current_user();
10159 + function show_top($user) {
10160 + $cur = common_current_user();
10161 hunk ./actions/showfavorites.php 67
10162 - if ($cur && $cur->id == $user->id) {
10163 - common_notice_form('all');
10165 + if ($cur && $cur->id == $user->id) {
10166 + common_notice_form('all');
10168 hunk ./actions/showfavorites.php 71
10169 - $this->show_feeds_list(array(0=>array('href'=>common_local_url('favoritesrss', array('nickname' => $user->nickname)),
10171 - 'version' => 'RSS 1.0',
10172 - 'item' => 'Favorites')));
10173 - $this->views_menu();
10175 + $this->show_feeds_list(array(0=>array('href'=>common_local_url('favoritesrss', array('nickname' => $user->nickname)),
10177 + 'version' => 'RSS 1.0',
10178 + 'item' => 'Favorites')));
10179 + $this->views_menu();
10181 hunk ./actions/showfavorites.php 78
10182 - function show_notices($user) {
10183 + function show_notices($user) {
10184 hunk ./actions/showfavorites.php 80
10185 - $page = $this->trimmed('page');
10189 + $page = $this->trimmed('page');
10193 hunk ./actions/showfavorites.php 85
10194 - $notice = $user->favoriteNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
10195 + $notice = $user->favoriteNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
10196 hunk ./actions/showfavorites.php 87
10198 - $this->server_error(_('Could not retrieve favorite notices.'));
10202 + $this->server_error(_('Could not retrieve favorite notices.'));
10205 hunk ./actions/showfavorites.php 94
10206 - common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
10207 - $page, 'showfavorites', array('nickname' => $user->nickname));
10209 + common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
10210 + $page, 'showfavorites', array('nickname' => $user->nickname));
10212 hunk ./actions/showmessage.php 26
10213 - function handle($args) {
10214 + function handle($args) {
10215 hunk ./actions/showmessage.php 28
10216 - Action::handle($args);
10217 + Action::handle($args);
10218 hunk ./actions/showmessage.php 30
10219 - $message = $this->get_message();
10220 + $message = $this->get_message();
10221 hunk ./actions/showmessage.php 32
10223 - $this->client_error(_('No such message.'), 404);
10227 - $cur = common_current_user();
10229 - if ($cur && ($cur->id == $message->from_profile || $cur->id == $message->to_profile)) {
10230 - $this->show_page($cur, 1);
10232 - $this->client_error(_('Only the sender and recipient may read this message.'), 403);
10237 - function get_message() {
10238 - $id = $this->trimmed('message');
10239 - $message = Message::staticGet('id', $id);
10243 - function get_title($user, $page) {
10244 - $message = $this->get_message();
10249 - if ($user->id == $message->from_profile) {
10250 - $to = $message->getTo();
10251 - $title = sprintf(_("Message to %1\$s on %2\$s"),
10253 - common_exact_date($message->created));
10254 - } else if ($user->id == $message->to_profile) {
10255 - $from = $message->getFrom();
10256 - $title = sprintf(_("Message from %1\$s on %2\$s"),
10258 - common_exact_date($message->created));
10263 + $this->client_error(_('No such message.'), 404);
10267 + $cur = common_current_user();
10269 + if ($cur && ($cur->id == $message->from_profile || $cur->id == $message->to_profile)) {
10270 + $this->show_page($cur, 1);
10272 + $this->client_error(_('Only the sender and recipient may read this message.'), 403);
10277 + function get_message() {
10278 + $id = $this->trimmed('message');
10279 + $message = Message::staticGet('id', $id);
10283 + function get_title($user, $page) {
10284 + $message = $this->get_message();
10289 + if ($user->id == $message->from_profile) {
10290 + $to = $message->getTo();
10291 + $title = sprintf(_("Message to %1\$s on %2\$s"),
10293 + common_exact_date($message->created));
10294 + } else if ($user->id == $message->to_profile) {
10295 + $from = $message->getFrom();
10296 + $title = sprintf(_("Message from %1\$s on %2\$s"),
10298 + common_exact_date($message->created));
10302 hunk ./actions/showmessage.php 73
10303 - function get_messages($user, $page) {
10304 - $message = new Message();
10305 - $message->id = $this->trimmed('message');
10306 - $message->find();
10310 - function get_message_profile($message) {
10311 - $user = common_current_user();
10312 - if ($user->id == $message->from_profile) {
10313 - return $message->getTo();
10314 - } else if ($user->id == $message->to_profile) {
10315 - return $message->getFrom();
10317 - # This shouldn't happen
10322 - function get_instructions() {
10326 - function views_menu() {
10329 + function get_messages($user, $page) {
10330 + $message = new Message();
10331 + $message->id = $this->trimmed('message');
10332 + $message->find();
10336 + function get_message_profile($message) {
10337 + $user = common_current_user();
10338 + if ($user->id == $message->from_profile) {
10339 + return $message->getTo();
10340 + } else if ($user->id == $message->to_profile) {
10341 + return $message->getFrom();
10343 + # This shouldn't happen
10348 + function get_instructions() {
10352 + function views_menu() {
10355 hunk ./actions/showmessage.php 100
10358 hunk ./actions/shownotice.php 26
10359 - var $notice = NULL;
10360 - var $profile = NULL;
10361 - var $avatar = NULL;
10362 + var $notice = NULL;
10363 + var $profile = NULL;
10364 + var $avatar = NULL;
10365 hunk ./actions/shownotice.php 30
10366 - function prepare($args) {
10367 + function prepare($args) {
10368 hunk ./actions/shownotice.php 32
10369 - parent::prepare($args);
10370 + parent::prepare($args);
10371 hunk ./actions/shownotice.php 34
10372 - $id = $this->arg('notice');
10373 - $this->notice = Notice::staticGet($id);
10374 + $id = $this->arg('notice');
10375 + $this->notice = Notice::staticGet($id);
10376 hunk ./actions/shownotice.php 37
10377 - if (!$this->notice) {
10378 - $this->client_error(_('No such notice.'), 404);
10381 + if (!$this->notice) {
10382 + $this->client_error(_('No such notice.'), 404);
10385 hunk ./actions/shownotice.php 42
10386 - $this->profile = $this->notice->getProfile();
10387 + $this->profile = $this->notice->getProfile();
10388 hunk ./actions/shownotice.php 44
10389 - if (!$this->profile) {
10390 - $this->server_error(_('Notice has no profile'), 500);
10393 + if (!$this->profile) {
10394 + $this->server_error(_('Notice has no profile'), 500);
10397 hunk ./actions/shownotice.php 49
10398 - $this->avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
10399 + $this->avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
10400 hunk ./actions/shownotice.php 51
10405 hunk ./actions/shownotice.php 54
10406 - function last_modified() {
10407 - return max(strtotime($this->notice->created),
10408 - strtotime($this->profile->modified),
10409 - ($this->avatar) ? strtotime($this->avatar->modified) : 0);
10411 + function last_modified() {
10412 + return max(strtotime($this->notice->created),
10413 + strtotime($this->profile->modified),
10414 + ($this->avatar) ? strtotime($this->avatar->modified) : 0);
10416 hunk ./actions/shownotice.php 60
10417 - function etag() {
10418 - return 'W/"' . implode(':', array($this->arg('action'),
10419 - common_language(),
10420 - $this->notice->id,
10421 - strtotime($this->notice->created),
10422 - strtotime($this->profile->modified),
10423 - ($this->avatar) ? strtotime($this->avatar->modified) : 0)) . '"';
10425 + function etag() {
10426 + return 'W/"' . implode(':', array($this->arg('action'),
10427 + common_language(),
10428 + $this->notice->id,
10429 + strtotime($this->notice->created),
10430 + strtotime($this->profile->modified),
10431 + ($this->avatar) ? strtotime($this->avatar->modified) : 0)) . '"';
10433 hunk ./actions/shownotice.php 69
10434 - function handle($args) {
10435 + function handle($args) {
10436 hunk ./actions/shownotice.php 71
10437 - parent::handle($args);
10438 + parent::handle($args);
10439 hunk ./actions/shownotice.php 73
10440 - common_show_header(sprintf(_('%1$s\'s status on %2$s'),
10441 - $this->profile->nickname,
10442 - common_exact_date($this->notice->created)),
10443 - array($this, 'show_header'), NULL,
10444 - array($this, 'show_top'));
10445 + common_show_header(sprintf(_('%1$s\'s status on %2$s'),
10446 + $this->profile->nickname,
10447 + common_exact_date($this->notice->created)),
10448 + array($this, 'show_header'), NULL,
10449 + array($this, 'show_top'));
10450 hunk ./actions/shownotice.php 79
10451 - common_element_start('ul', array('id' => 'notices'));
10452 + common_element_start('ul', array('id' => 'notices'));
10453 hunk ./actions/shownotice.php 82
10454 - common_element_end('ul');
10455 + common_element_end('ul');
10456 hunk ./actions/shownotice.php 84
10457 - common_show_footer();
10459 + common_show_footer();
10461 hunk ./actions/shownotice.php 87
10462 - function show_header() {
10463 + function show_header() {
10464 hunk ./actions/shownotice.php 89
10465 - $user = User::staticGet($this->profile->id);
10466 + $user = User::staticGet($this->profile->id);
10467 hunk ./actions/shownotice.php 91
10474 hunk ./actions/shownotice.php 95
10475 - if ($user->emailmicroid && $user->email && $this->notice->uri) {
10476 - common_element('meta', array('name' => 'microid',
10477 - 'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($this->notice->uri))));
10479 + if ($user->emailmicroid && $user->email && $this->notice->uri) {
10480 + common_element('meta', array('name' => 'microid',
10481 + 'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($this->notice->uri))));
10483 hunk ./actions/shownotice.php 100
10484 - if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
10485 - common_element('meta', array('name' => 'microid',
10486 - 'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($this->notice->uri))));
10489 + if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
10490 + common_element('meta', array('name' => 'microid',
10491 + 'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($this->notice->uri))));
10494 hunk ./actions/shownotice.php 106
10495 - function show_top() {
10496 - $cur = common_current_user();
10497 - if ($cur && $cur->id == $this->profile->id) {
10498 - common_notice_form();
10501 + function show_top() {
10502 + $cur = common_current_user();
10503 + if ($cur && $cur->id == $this->profile->id) {
10504 + common_notice_form();
10507 hunk ./actions/shownotice.php 113
10508 - function no_such_notice() {
10509 - common_user_error(_('No such notice.'));
10511 + function no_such_notice() {
10512 + common_user_error(_('No such notice.'));
10514 hunk ./actions/showstream.php 29
10515 - function handle($args) {
10516 + function handle($args) {
10517 hunk ./actions/showstream.php 31
10518 - parent::handle($args);
10519 + parent::handle($args);
10520 hunk ./actions/showstream.php 34
10521 - $nickname = common_canonical_nickname($nickname_arg);
10522 + $nickname = common_canonical_nickname($nickname_arg);
10523 hunk ./actions/showstream.php 47
10524 - $user = User::staticGet('nickname', $nickname);
10525 + $user = User::staticGet('nickname', $nickname);
10526 hunk ./actions/showstream.php 49
10528 - $this->no_such_user();
10532 + $this->no_such_user();
10535 hunk ./actions/showstream.php 54
10536 - $profile = $user->getProfile();
10537 + $profile = $user->getProfile();
10538 hunk ./actions/showstream.php 56
10540 - common_server_error(_('User has no profile.'));
10544 + common_server_error(_('User has no profile.'));
10547 hunk ./actions/showstream.php 61
10548 - # Looks like we're good; start output
10549 + # Looks like we're good; start output
10550 hunk ./actions/showstream.php 63
10551 - # For YADIS discovery, we also have a <meta> tag
10552 + # For YADIS discovery, we also have a <meta> tag
10553 hunk ./actions/showstream.php 65
10554 - header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
10555 - $user->nickname)));
10556 + header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
10557 + $user->nickname)));
10558 hunk ./actions/showstream.php 68
10559 - common_show_header($profile->nickname,
10560 - array($this, 'show_header'), $user,
10561 - array($this, 'show_top'));
10562 + common_show_header($profile->nickname,
10563 + array($this, 'show_header'), $user,
10564 + array($this, 'show_top'));
10565 hunk ./actions/showstream.php 72
10566 - $this->show_profile($profile);
10567 + $this->show_profile($profile);
10568 hunk ./actions/showstream.php 74
10569 - $this->show_notices($user);
10570 + $this->show_notices($user);
10571 hunk ./actions/showstream.php 76
10572 - common_show_footer();
10574 + common_show_footer();
10576 hunk ./actions/showstream.php 79
10577 - function show_top($user) {
10578 - $cur = common_current_user();
10579 + function show_top($user) {
10580 + $cur = common_current_user();
10581 hunk ./actions/showstream.php 82
10582 - if ($cur && $cur->id == $user->id) {
10583 - common_notice_form('showstream');
10585 + if ($cur && $cur->id == $user->id) {
10586 + common_notice_form('showstream');
10588 hunk ./actions/showstream.php 86
10589 - $this->views_menu();
10590 + $this->views_menu();
10591 hunk ./actions/showstream.php 88
10592 - $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('nickname' => $user->nickname)),
10594 - 'version' => 'RSS 1.0',
10595 - 'item' => 'notices'),
10596 - 1=>array('href'=>common_local_url('usertimeline', array('nickname' => $user->nickname)),
10597 - 'type' => 'atom',
10598 - 'version' => 'Atom 1.0',
10599 - 'item' => 'usertimeline'),
10600 + $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('nickname' => $user->nickname)),
10602 + 'version' => 'RSS 1.0',
10603 + 'item' => 'notices'),
10604 + 1=>array('href'=>common_local_url('usertimeline', array('nickname' => $user->nickname)),
10605 + 'type' => 'atom',
10606 + 'version' => 'Atom 1.0',
10607 + 'item' => 'usertimeline'),
10608 hunk ./actions/showstream.php 97
10609 - 2=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
10611 - 'version' => 'FOAF',
10612 - 'item' => 'foaf')));
10614 + 2=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
10616 + 'version' => 'FOAF',
10617 + 'item' => 'foaf')));
10619 hunk ./actions/showstream.php 103
10620 - function show_header($user) {
10622 - common_element('link', array('rel' => 'alternate',
10623 - 'href' => common_local_url('api',
10624 - array('apiaction' => 'statuses',
10625 - 'method' => 'user_timeline.rss',
10626 - 'argument' => $user->nickname)),
10627 - 'type' => 'application/rss+xml',
10628 - 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
10629 - common_element('link', array('rel' => 'alternate feed',
10630 - 'href' => common_local_url('api',
10631 - array('apiaction' => 'statuses',
10632 - 'method' => 'user_timeline.atom',
10633 - 'argument' => $user->nickname)),
10634 - 'type' => 'application/atom+xml',
10635 - 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
10636 - common_element('link', array('rel' => 'alternate',
10637 - 'href' => common_local_url('userrss', array('nickname' =>
10638 - $user->nickname)),
10639 - 'type' => 'application/rdf+xml',
10640 - 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
10642 - common_element('link', array('rel' => 'meta',
10643 - 'href' => common_local_url('foaf', array('nickname' =>
10644 - $user->nickname)),
10645 - 'type' => 'application/rdf+xml',
10646 - 'title' => 'FOAF'));
10647 - # for remote subscriptions etc.
10648 - common_element('meta', array('http-equiv' => 'X-XRDS-Location',
10649 - 'content' => common_local_url('xrds', array('nickname' =>
10650 - $user->nickname))));
10651 - $profile = $user->getProfile();
10652 - if ($profile->bio) {
10653 - common_element('meta', array('name' => 'description',
10654 - 'content' => $profile->bio));
10656 + function show_header($user) {
10658 + common_element('link', array('rel' => 'alternate',
10659 + 'href' => common_local_url('api',
10660 + array('apiaction' => 'statuses',
10661 + 'method' => 'user_timeline.rss',
10662 + 'argument' => $user->nickname)),
10663 + 'type' => 'application/rss+xml',
10664 + 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
10665 + common_element('link', array('rel' => 'alternate feed',
10666 + 'href' => common_local_url('api',
10667 + array('apiaction' => 'statuses',
10668 + 'method' => 'user_timeline.atom',
10669 + 'argument' => $user->nickname)),
10670 + 'type' => 'application/atom+xml',
10671 + 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
10672 + common_element('link', array('rel' => 'alternate',
10673 + 'href' => common_local_url('userrss', array('nickname' =>
10674 + $user->nickname)),
10675 + 'type' => 'application/rdf+xml',
10676 + 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
10678 + common_element('link', array('rel' => 'meta',
10679 + 'href' => common_local_url('foaf', array('nickname' =>
10680 + $user->nickname)),
10681 + 'type' => 'application/rdf+xml',
10682 + 'title' => 'FOAF'));
10683 + # for remote subscriptions etc.
10684 + common_element('meta', array('http-equiv' => 'X-XRDS-Location',
10685 + 'content' => common_local_url('xrds', array('nickname' =>
10686 + $user->nickname))));
10687 + $profile = $user->getProfile();
10688 + if ($profile->bio) {
10689 + common_element('meta', array('name' => 'description',
10690 + 'content' => $profile->bio));
10692 hunk ./actions/showstream.php 140
10693 - if ($user->emailmicroid && $user->email && $profile->profileurl) {
10694 - common_element('meta', array('name' => 'microid',
10695 - 'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
10697 - if ($user->jabbermicroid && $user->jabber && $profile->profileurl) {
10698 - common_element('meta', array('name' => 'microid',
10699 - 'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
10701 + if ($user->emailmicroid && $user->email && $profile->profileurl) {
10702 + common_element('meta', array('name' => 'microid',
10703 + 'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
10705 + if ($user->jabbermicroid && $user->jabber && $profile->profileurl) {
10706 + common_element('meta', array('name' => 'microid',
10707 + 'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
10709 hunk ./actions/showstream.php 149
10710 - # See https://wiki.mozilla.org/Microsummaries
10711 + # See https://wiki.mozilla.org/Microsummaries
10712 hunk ./actions/showstream.php 151
10713 - common_element('link', array('rel' => 'microsummary',
10714 - 'href' => common_local_url('microsummary',
10715 - array('nickname' => $profile->nickname))));
10717 + common_element('link', array('rel' => 'microsummary',
10718 + 'href' => common_local_url('microsummary',
10719 + array('nickname' => $profile->nickname))));
10721 hunk ./actions/showstream.php 156
10722 - function no_such_user() {
10723 - $this->client_error(_('No such user.'), 404);
10725 + function no_such_user() {
10726 + $this->client_error(_('No such user.'), 404);
10728 hunk ./actions/showstream.php 160
10729 - function show_profile($profile) {
10730 + function show_profile($profile) {
10731 hunk ./actions/showstream.php 162
10732 - common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
10733 + common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
10734 hunk ./actions/showstream.php 164
10735 - $this->show_personal($profile);
10736 + $this->show_personal($profile);
10737 hunk ./actions/showstream.php 166
10738 - $this->show_last_notice($profile);
10739 + $this->show_last_notice($profile);
10740 hunk ./actions/showstream.php 168
10741 - $cur = common_current_user();
10742 + $cur = common_current_user();
10743 hunk ./actions/showstream.php 170
10744 - $this->show_subscriptions($profile);
10745 + $this->show_subscriptions($profile);
10746 hunk ./actions/showstream.php 172
10747 - common_element_end('div');
10749 + common_element_end('div');
10751 hunk ./actions/showstream.php 175
10752 - function show_personal($profile) {
10753 + function show_personal($profile) {
10754 hunk ./actions/showstream.php 177
10755 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
10756 - common_element_start('div', array('id' => 'profile_avatar'));
10757 - common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
10758 - 'class' => 'avatar profile photo',
10759 - 'width' => AVATAR_PROFILE_SIZE,
10760 - 'height' => AVATAR_PROFILE_SIZE,
10761 - 'alt' => $profile->nickname));
10762 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
10763 + common_element_start('div', array('id' => 'profile_avatar'));
10764 + common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
10765 + 'class' => 'avatar profile photo',
10766 + 'width' => AVATAR_PROFILE_SIZE,
10767 + 'height' => AVATAR_PROFILE_SIZE,
10768 + 'alt' => $profile->nickname));
10769 hunk ./actions/showstream.php 188
10770 - $cur = common_current_user();
10772 - if ($cur->id != $profile->id) {
10773 - if ($cur->isSubscribed($profile)) {
10774 - common_unsubscribe_form($profile);
10776 - common_subscribe_form($profile);
10780 - $this->show_remote_subscribe_link($profile);
10782 + $cur = common_current_user();
10784 + if ($cur->id != $profile->id) {
10785 + if ($cur->isSubscribed($profile)) {
10786 + common_unsubscribe_form($profile);
10788 + common_subscribe_form($profile);
10792 + $this->show_remote_subscribe_link($profile);
10794 hunk ./actions/showstream.php 202
10795 - $user = User::staticGet('id', $profile->id);
10796 - common_profile_new_message_nudge($cur, $user, $profile);
10797 + $user = User::staticGet('id', $profile->id);
10798 + common_profile_new_message_nudge($cur, $user, $profile);
10799 hunk ./actions/showstream.php 218
10800 - common_element_end('ul');
10801 + common_element_end('ul');
10802 hunk ./actions/showstream.php 220
10803 - common_element_end('div');
10804 + common_element_end('div');
10805 hunk ./actions/showstream.php 222
10806 - common_element_start('div', array('id' => 'profile_information'));
10807 + common_element_start('div', array('id' => 'profile_information'));
10808 hunk ./actions/showstream.php 224
10809 - if ($profile->fullname) {
10810 - common_element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
10812 - common_element('h1', array('class' => 'fn nickname'), $profile->nickname);
10814 + if ($profile->fullname) {
10815 + common_element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
10817 + common_element('h1', array('class' => 'fn nickname'), $profile->nickname);
10819 hunk ./actions/showstream.php 230
10820 - if ($profile->location) {
10821 - common_element('p', 'location', $profile->location);
10823 - if ($profile->bio) {
10824 - common_element('p', 'description note', $profile->bio);
10826 - if ($profile->homepage) {
10827 - common_element_start('p', 'website');
10828 - common_element('a', array('href' => $profile->homepage,
10829 - 'rel' => 'me', 'class' => 'url'),
10830 - $profile->homepage);
10831 - common_element_end('p');
10833 + if ($profile->location) {
10834 + common_element('p', 'location', $profile->location);
10836 + if ($profile->bio) {
10837 + common_element('p', 'description note', $profile->bio);
10839 + if ($profile->homepage) {
10840 + common_element_start('p', 'website');
10841 + common_element('a', array('href' => $profile->homepage,
10842 + 'rel' => 'me', 'class' => 'url'),
10843 + $profile->homepage);
10844 + common_element_end('p');
10846 hunk ./actions/showstream.php 244
10847 - $this->show_statistics($profile);
10848 + $this->show_statistics($profile);
10849 hunk ./actions/showstream.php 246
10850 - common_element_end('div');
10852 + common_element_end('div');
10854 hunk ./actions/showstream.php 249
10855 - function show_remote_subscribe_link($profile) {
10856 - $url = common_local_url('remotesubscribe',
10857 - array('nickname' => $profile->nickname));
10858 - common_element('a', array('href' => $url,
10859 - 'id' => 'remotesubscribe'),
10862 + function show_remote_subscribe_link($profile) {
10863 + $url = common_local_url('remotesubscribe',
10864 + array('nickname' => $profile->nickname));
10865 + common_element('a', array('href' => $url,
10866 + 'id' => 'remotesubscribe'),
10869 hunk ./actions/showstream.php 257
10870 - function show_unsubscribe_form($profile) {
10871 - common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
10872 - 'action' => common_local_url('unsubscribe')));
10873 - common_hidden('token', common_session_token());
10874 - common_element('input', array('id' => 'unsubscribeto',
10875 - 'name' => 'unsubscribeto',
10876 - 'type' => 'hidden',
10877 - 'value' => $profile->nickname));
10878 - common_element('input', array('type' => 'submit',
10879 - 'class' => 'submit',
10880 - 'value' => _('Unsubscribe')));
10881 - common_element_end('form');
10883 + function show_unsubscribe_form($profile) {
10884 + common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
10885 + 'action' => common_local_url('unsubscribe')));
10886 + common_hidden('token', common_session_token());
10887 + common_element('input', array('id' => 'unsubscribeto',
10888 + 'name' => 'unsubscribeto',
10889 + 'type' => 'hidden',
10890 + 'value' => $profile->nickname));
10891 + common_element('input', array('type' => 'submit',
10892 + 'class' => 'submit',
10893 + 'value' => _('Unsubscribe')));
10894 + common_element_end('form');
10896 hunk ./actions/showstream.php 271
10897 - function show_subscriptions($profile) {
10899 + function show_subscriptions($profile) {
10901 hunk ./actions/showstream.php 274
10902 - $subs = DB_DataObject::factory('subscription');
10903 - $subs->subscriber = $profile->id;
10904 - $subs->whereAdd('subscribed != ' . $profile->id);
10905 + $subs = DB_DataObject::factory('subscription');
10906 + $subs->subscriber = $profile->id;
10907 + $subs->whereAdd('subscribed != ' . $profile->id);
10908 hunk ./actions/showstream.php 278
10909 - $subs->orderBy('created DESC');
10910 + $subs->orderBy('created DESC');
10911 hunk ./actions/showstream.php 280
10912 - # We ask for an extra one to know if we need to do another page
10913 + # We ask for an extra one to know if we need to do another page
10914 hunk ./actions/showstream.php 282
10915 - $subs->limit(0, SUBSCRIPTIONS + 1);
10916 + $subs->limit(0, SUBSCRIPTIONS + 1);
10917 hunk ./actions/showstream.php 284
10918 - $subs_count = $subs->find();
10919 + $subs_count = $subs->find();
10920 hunk ./actions/showstream.php 286
10921 - common_element_start('div', array('id' => 'subscriptions'));
10922 + common_element_start('div', array('id' => 'subscriptions'));
10923 hunk ./actions/showstream.php 288
10924 - common_element('h2', NULL, _('Subscriptions'));
10925 + common_element('h2', NULL, _('Subscriptions'));
10926 hunk ./actions/showstream.php 290
10927 - if ($subs_count > 0) {
10928 + if ($subs_count > 0) {
10929 hunk ./actions/showstream.php 292
10930 - common_element_start('ul', array('id' => 'subscriptions_avatars'));
10931 + common_element_start('ul', array('id' => 'subscriptions_avatars'));
10932 hunk ./actions/showstream.php 294
10933 - for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
10934 + for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
10935 hunk ./actions/showstream.php 296
10936 - if (!$subs->fetch()) {
10937 - common_debug('Weirdly, broke out of subscriptions loop early', __FILE__);
10940 + if (!$subs->fetch()) {
10941 + common_debug('Weirdly, broke out of subscriptions loop early', __FILE__);
10944 hunk ./actions/showstream.php 301
10945 - $other = Profile::staticGet($subs->subscribed);
10946 + $other = Profile::staticGet($subs->subscribed);
10947 hunk ./actions/showstream.php 303
10949 - common_log_db_error($subs, 'SELECT', __FILE__);
10953 + common_log_db_error($subs, 'SELECT', __FILE__);
10956 hunk ./actions/showstream.php 308
10957 - common_element_start('li', 'vcard');
10958 - common_element_start('a', array('title' => ($other->fullname) ?
10959 - $other->fullname :
10960 - $other->nickname,
10961 - 'href' => $other->profileurl,
10962 - 'rel' => 'contact',
10963 - 'class' => 'subscription fn url'));
10964 - $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
10965 - common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
10966 - 'width' => AVATAR_MINI_SIZE,
10967 - 'height' => AVATAR_MINI_SIZE,
10968 - 'class' => 'avatar mini photo',
10969 - 'alt' => ($other->fullname) ?
10970 - $other->fullname :
10971 - $other->nickname));
10972 - common_element_end('a');
10973 - common_element_end('li');
10975 + common_element_start('li', 'vcard');
10976 + common_element_start('a', array('title' => ($other->fullname) ?
10977 + $other->fullname :
10978 + $other->nickname,
10979 + 'href' => $other->profileurl,
10980 + 'rel' => 'contact',
10981 + 'class' => 'subscription fn url'));
10982 + $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
10983 + common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
10984 + 'width' => AVATAR_MINI_SIZE,
10985 + 'height' => AVATAR_MINI_SIZE,
10986 + 'class' => 'avatar mini photo',
10987 + 'alt' => ($other->fullname) ?
10988 + $other->fullname :
10989 + $other->nickname));
10990 + common_element_end('a');
10991 + common_element_end('li');
10993 hunk ./actions/showstream.php 327
10994 - common_element_end('ul');
10996 + common_element_end('ul');
10998 hunk ./actions/showstream.php 330
10999 - if ($subs_count > SUBSCRIPTIONS) {
11000 - common_element_start('p', array('id' => 'subscriptions_viewall'));
11001 + if ($subs_count > SUBSCRIPTIONS) {
11002 + common_element_start('p', array('id' => 'subscriptions_viewall'));
11003 hunk ./actions/showstream.php 333
11004 - common_element('a', array('href' => common_local_url('subscriptions',
11005 - array('nickname' => $profile->nickname)),
11006 - 'class' => 'moresubscriptions'),
11007 - _('All subscriptions'));
11008 - common_element_end('p');
11010 + common_element('a', array('href' => common_local_url('subscriptions',
11011 + array('nickname' => $profile->nickname)),
11012 + 'class' => 'moresubscriptions'),
11013 + _('All subscriptions'));
11014 + common_element_end('p');
11016 hunk ./actions/showstream.php 340
11017 - common_element_end('div');
11019 + common_element_end('div');
11021 hunk ./actions/showstream.php 343
11022 - function show_statistics($profile) {
11023 + function show_statistics($profile) {
11024 hunk ./actions/showstream.php 345
11025 - // XXX: WORM cache this
11026 - $subs = DB_DataObject::factory('subscription');
11027 - $subs->subscriber = $profile->id;
11028 - $subs_count = (int) $subs->count() - 1;
11029 + // XXX: WORM cache this
11030 + $subs = DB_DataObject::factory('subscription');
11031 + $subs->subscriber = $profile->id;
11032 + $subs_count = (int) $subs->count() - 1;
11033 hunk ./actions/showstream.php 350
11034 - $subbed = DB_DataObject::factory('subscription');
11035 - $subbed->subscribed = $profile->id;
11036 - $subbed_count = (int) $subbed->count() - 1;
11037 + $subbed = DB_DataObject::factory('subscription');
11038 + $subbed->subscribed = $profile->id;
11039 + $subbed_count = (int) $subbed->count() - 1;
11040 hunk ./actions/showstream.php 354
11041 - $notices = DB_DataObject::factory('notice');
11042 - $notices->profile_id = $profile->id;
11043 - $notice_count = (int) $notices->count();
11044 + $notices = DB_DataObject::factory('notice');
11045 + $notices->profile_id = $profile->id;
11046 + $notice_count = (int) $notices->count();
11047 hunk ./actions/showstream.php 358
11048 - common_element_start('div', 'statistics');
11049 - common_element('h2', 'statistics', _('Statistics'));
11050 + common_element_start('div', 'statistics');
11051 + common_element('h2', 'statistics', _('Statistics'));
11052 hunk ./actions/showstream.php 361
11053 - # Other stats...?
11054 - common_element_start('dl', 'statistics');
11055 - common_element('dt', 'membersince', _('Member since'));
11056 - common_element('dd', 'membersince', date('j M Y',
11057 - strtotime($profile->created)));
11058 + # Other stats...?
11059 + common_element_start('dl', 'statistics');
11060 + common_element('dt', 'membersince', _('Member since'));
11061 + common_element('dd', 'membersince', date('j M Y',
11062 + strtotime($profile->created)));
11063 hunk ./actions/showstream.php 367
11064 - common_element_start('dt', 'subscriptions');
11065 - common_element('a', array('href' => common_local_url('subscriptions',
11066 - array('nickname' => $profile->nickname))),
11067 - _('Subscriptions'));
11068 - common_element_end('dt');
11069 - common_element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
11070 - common_element_start('dt', 'subscribers');
11071 - common_element('a', array('href' => common_local_url('subscribers',
11072 - array('nickname' => $profile->nickname))),
11073 - _('Subscribers'));
11074 - common_element_end('dt');
11075 - common_element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
11076 - common_element('dt', 'notices', _('Notices'));
11077 - common_element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
11078 - # XXX: link these to something
11079 - common_element('dt', 'tags', _('Tags'));
11080 - common_element_start('dd', 'tags');
11081 - $tags = Profile_tag::getTags($profile->id, $profile->id);
11082 + common_element_start('dt', 'subscriptions');
11083 + common_element('a', array('href' => common_local_url('subscriptions',
11084 + array('nickname' => $profile->nickname))),
11085 + _('Subscriptions'));
11086 + common_element_end('dt');
11087 + common_element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
11088 + common_element_start('dt', 'subscribers');
11089 + common_element('a', array('href' => common_local_url('subscribers',
11090 + array('nickname' => $profile->nickname))),
11091 + _('Subscribers'));
11092 + common_element_end('dt');
11093 + common_element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
11094 + common_element('dt', 'notices', _('Notices'));
11095 + common_element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
11096 + # XXX: link these to something
11097 + common_element('dt', 'tags', _('Tags'));
11098 + common_element_start('dd', 'tags');
11099 + $tags = Profile_tag::getTags($profile->id, $profile->id);
11100 hunk ./actions/showstream.php 386
11101 - common_element_start('ul', 'tags xoxo');
11102 - foreach ($tags as $tag) {
11103 - common_element_start('li');
11104 - common_element('a', array('rel' => 'bookmark tag',
11105 - 'href' => common_local_url('peopletag',
11106 - array('tag' => $tag))),
11108 - common_element_end('li');
11110 - common_element_end('ul');
11111 - common_element_end('dd');
11112 + common_element_start('ul', 'tags xoxo');
11113 + foreach ($tags as $tag) {
11114 + common_element_start('li');
11115 + common_element('a', array('rel' => 'bookmark tag',
11116 + 'href' => common_local_url('peopletag',
11117 + array('tag' => $tag))),
11119 + common_element_end('li');
11121 + common_element_end('ul');
11122 + common_element_end('dd');
11123 hunk ./actions/showstream.php 398
11124 - common_element_end('dl');
11125 + common_element_end('dl');
11126 hunk ./actions/showstream.php 400
11127 - common_element_end('div');
11129 + common_element_end('div');
11131 hunk ./actions/showstream.php 403
11132 - function show_notices($user) {
11133 + function show_notices($user) {
11134 hunk ./actions/showstream.php 405
11135 - $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
11136 + $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
11137 hunk ./actions/showstream.php 407
11138 - $notice = $user->getNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
11139 + $notice = $user->getNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
11140 hunk ./actions/showstream.php 412
11141 - common_pagination($page>1, $cnt>NOTICES_PER_PAGE, $page,
11142 - 'showstream', array('nickname' => $user->nickname));
11144 + common_pagination($page>1, $cnt>NOTICES_PER_PAGE, $page,
11145 + 'showstream', array('nickname' => $user->nickname));
11147 hunk ./actions/showstream.php 416
11148 - function show_last_notice($profile) {
11149 + function show_last_notice($profile) {
11150 hunk ./actions/showstream.php 418
11151 - common_element('h2', NULL, _('Currently'));
11152 + common_element('h2', NULL, _('Currently'));
11153 hunk ./actions/showstream.php 420
11154 - $notice = $profile->getCurrentNotice();
11155 + $notice = $profile->getCurrentNotice();
11156 hunk ./actions/showstream.php 422
11158 - # FIXME: URL, image, video, audio
11159 - common_element_start('p', array('class' => 'notice_current'));
11160 - if ($notice->rendered) {
11161 - common_raw($notice->rendered);
11163 - # XXX: may be some uncooked notices in the DB,
11164 - # we cook them right now. This can probably disappear in future
11165 - # versions (>> 0.4.x)
11166 - common_raw(common_render_content($notice->content, $notice));
11168 - common_element_end('p');
11172 + # FIXME: URL, image, video, audio
11173 + common_element_start('p', array('class' => 'notice_current'));
11174 + if ($notice->rendered) {
11175 + common_raw($notice->rendered);
11177 + # XXX: may be some uncooked notices in the DB,
11178 + # we cook them right now. This can probably disappear in future
11179 + # versions (>> 0.4.x)
11180 + common_raw(common_render_content($notice->content, $notice));
11182 + common_element_end('p');
11185 hunk ./actions/smssettings.php 27
11186 - function get_instructions() {
11187 - return _('You can receive SMS messages through email from %%site.name%%.');
11189 + function get_instructions() {
11190 + return _('You can receive SMS messages through email from %%site.name%%.');
11192 hunk ./actions/smssettings.php 31
11193 - function show_form($msg=NULL, $success=false) {
11194 - $user = common_current_user();
11195 - $this->form_header(_('SMS Settings'), $msg, $success);
11196 - common_element_start('form', array('method' => 'post',
11197 - 'id' => 'smssettings',
11199 - common_local_url('smssettings')));
11200 - common_hidden('token', common_session_token());
11201 - common_element('h2', NULL, _('Address'));
11202 + function show_form($msg=NULL, $success=false) {
11203 + $user = common_current_user();
11204 + $this->form_header(_('SMS Settings'), $msg, $success);
11205 + common_element_start('form', array('method' => 'post',
11206 + 'id' => 'smssettings',
11208 + common_local_url('smssettings')));
11209 + common_hidden('token', common_session_token());
11210 + common_element('h2', NULL, _('Address'));
11211 hunk ./actions/smssettings.php 41
11212 - if ($user->sms) {
11213 - common_element_start('p');
11214 - $carrier = $user->getCarrier();
11215 - common_element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
11216 - common_element('span', 'input_instructions',
11217 - _('Current confirmed SMS-enabled phone number.'));
11218 - common_hidden('sms', $user->sms);
11219 - common_hidden('carrier', $user->carrier);
11220 - common_element_end('p');
11221 - common_submit('remove', _('Remove'));
11223 - $confirm = $this->get_confirmation();
11225 - $carrier = Sms_carrier::staticGet($confirm->address_extra);
11226 - common_element_start('p');
11227 - common_element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
11228 - common_element('span', 'input_instructions',
11229 - _('Awaiting confirmation on this phone number.'));
11230 - common_hidden('sms', $confirm->address);
11231 - common_hidden('carrier', $confirm->address_extra);
11232 - common_element_end('p');
11233 - common_submit('cancel', _('Cancel'));
11234 - common_input('code', _('Confirmation code'), NULL,
11235 - _('Enter the code you received on your phone.'));
11236 - common_submit('confirm', _('Confirm'));
11238 - common_input('sms', _('SMS Phone number'),
11239 - ($this->arg('sms')) ? $this->arg('sms') : NULL,
11240 - _('Phone number, no punctuation or spaces, with area code'));
11241 - $this->carrier_select();
11242 - common_submit('add', _('Add'));
11245 + if ($user->sms) {
11246 + common_element_start('p');
11247 + $carrier = $user->getCarrier();
11248 + common_element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
11249 + common_element('span', 'input_instructions',
11250 + _('Current confirmed SMS-enabled phone number.'));
11251 + common_hidden('sms', $user->sms);
11252 + common_hidden('carrier', $user->carrier);
11253 + common_element_end('p');
11254 + common_submit('remove', _('Remove'));
11256 + $confirm = $this->get_confirmation();
11258 + $carrier = Sms_carrier::staticGet($confirm->address_extra);
11259 + common_element_start('p');
11260 + common_element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
11261 + common_element('span', 'input_instructions',
11262 + _('Awaiting confirmation on this phone number.'));
11263 + common_hidden('sms', $confirm->address);
11264 + common_hidden('carrier', $confirm->address_extra);
11265 + common_element_end('p');
11266 + common_submit('cancel', _('Cancel'));
11267 + common_input('code', _('Confirmation code'), NULL,
11268 + _('Enter the code you received on your phone.'));
11269 + common_submit('confirm', _('Confirm'));
11271 + common_input('sms', _('SMS Phone number'),
11272 + ($this->arg('sms')) ? $this->arg('sms') : NULL,
11273 + _('Phone number, no punctuation or spaces, with area code'));
11274 + $this->carrier_select();
11275 + common_submit('add', _('Add'));
11278 hunk ./actions/smssettings.php 75
11279 - if ($user->sms) {
11280 - common_element('h2', NULL, _('Incoming email'));
11282 - if ($user->incomingemail) {
11283 - common_element_start('p');
11284 - common_element('span', 'address', $user->incomingemail);
11285 - common_element('span', 'input_instructions',
11286 - _('Send email to this address to post new notices.'));
11287 - common_element_end('p');
11288 - common_submit('removeincoming', _('Remove'));
11291 - common_element_start('p');
11292 - common_element('span', 'input_instructions',
11293 - _('Make a new email address for posting to; cancels the old one.'));
11294 - common_element_end('p');
11295 - common_submit('newincoming', _('New'));
11298 - common_element('h2', NULL, _('Preferences'));
11300 - common_checkbox('smsnotify',
11301 - _('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
11302 - $user->smsnotify);
11304 - common_submit('save', _('Save'));
11306 - common_element_end('form');
11307 - common_show_footer();
11309 + if ($user->sms) {
11310 + common_element('h2', NULL, _('Incoming email'));
11312 + if ($user->incomingemail) {
11313 + common_element_start('p');
11314 + common_element('span', 'address', $user->incomingemail);
11315 + common_element('span', 'input_instructions',
11316 + _('Send email to this address to post new notices.'));
11317 + common_element_end('p');
11318 + common_submit('removeincoming', _('Remove'));
11321 + common_element_start('p');
11322 + common_element('span', 'input_instructions',
11323 + _('Make a new email address for posting to; cancels the old one.'));
11324 + common_element_end('p');
11325 + common_submit('newincoming', _('New'));
11328 + common_element('h2', NULL, _('Preferences'));
11330 + common_checkbox('smsnotify',
11331 + _('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
11332 + $user->smsnotify);
11334 + common_submit('save', _('Save'));
11336 + common_element_end('form');
11337 + common_show_footer();
11339 hunk ./actions/smssettings.php 106
11340 - function get_confirmation() {
11341 - $user = common_current_user();
11342 - $confirm = new Confirm_address();
11343 - $confirm->user_id = $user->id;
11344 - $confirm->address_type = 'sms';
11345 - if ($confirm->find(TRUE)) {
11351 + function get_confirmation() {
11352 + $user = common_current_user();
11353 + $confirm = new Confirm_address();
11354 + $confirm->user_id = $user->id;
11355 + $confirm->address_type = 'sms';
11356 + if ($confirm->find(TRUE)) {
11362 hunk ./actions/smssettings.php 118
11363 - function handle_post() {
11364 + function handle_post() {
11365 hunk ./actions/smssettings.php 120
11366 - # CSRF protection
11367 + # CSRF protection
11368 hunk ./actions/smssettings.php 122
11369 - $token = $this->trimmed('token');
11370 - if (!$token || $token != common_session_token()) {
11371 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
11374 + $token = $this->trimmed('token');
11375 + if (!$token || $token != common_session_token()) {
11376 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
11379 hunk ./actions/smssettings.php 128
11380 - if ($this->arg('save')) {
11381 - $this->save_preferences();
11382 - } else if ($this->arg('add')) {
11383 - $this->add_address();
11384 - } else if ($this->arg('cancel')) {
11385 - $this->cancel_confirmation();
11386 - } else if ($this->arg('remove')) {
11387 - $this->remove_address();
11388 - } else if ($this->arg('removeincoming')) {
11389 - $this->remove_incoming();
11390 - } else if ($this->arg('newincoming')) {
11391 - $this->new_incoming();
11392 - } else if ($this->arg('confirm')) {
11393 - $this->confirm_code();
11395 - $this->show_form(_('Unexpected form submission.'));
11398 + if ($this->arg('save')) {
11399 + $this->save_preferences();
11400 + } else if ($this->arg('add')) {
11401 + $this->add_address();
11402 + } else if ($this->arg('cancel')) {
11403 + $this->cancel_confirmation();
11404 + } else if ($this->arg('remove')) {
11405 + $this->remove_address();
11406 + } else if ($this->arg('removeincoming')) {
11407 + $this->remove_incoming();
11408 + } else if ($this->arg('newincoming')) {
11409 + $this->new_incoming();
11410 + } else if ($this->arg('confirm')) {
11411 + $this->confirm_code();
11413 + $this->show_form(_('Unexpected form submission.'));
11416 hunk ./actions/smssettings.php 147
11417 - function save_preferences() {
11418 + function save_preferences() {
11419 hunk ./actions/smssettings.php 149
11420 - $smsnotify = $this->boolean('smsnotify');
11422 - $user = common_current_user();
11423 + $smsnotify = $this->boolean('smsnotify');
11425 + $user = common_current_user();
11426 hunk ./actions/smssettings.php 153
11427 - assert(!is_null($user)); # should already be checked
11428 + assert(!is_null($user)); # should already be checked
11429 hunk ./actions/smssettings.php 155
11430 - $user->query('BEGIN');
11431 + $user->query('BEGIN');
11432 hunk ./actions/smssettings.php 157
11433 - $original = clone($user);
11434 + $original = clone($user);
11435 hunk ./actions/smssettings.php 159
11436 - $user->smsnotify = $smsnotify;
11437 + $user->smsnotify = $smsnotify;
11438 hunk ./actions/smssettings.php 161
11439 - $result = $user->update($original);
11440 + $result = $user->update($original);
11441 hunk ./actions/smssettings.php 163
11442 - if ($result === FALSE) {
11443 - common_log_db_error($user, 'UPDATE', __FILE__);
11444 - common_server_error(_('Couldn\'t update user.'));
11447 + if ($result === FALSE) {
11448 + common_log_db_error($user, 'UPDATE', __FILE__);
11449 + common_server_error(_('Couldn\'t update user.'));
11452 hunk ./actions/smssettings.php 169
11453 - $user->query('COMMIT');
11454 + $user->query('COMMIT');
11455 hunk ./actions/smssettings.php 171
11456 - $this->show_form(_('Preferences saved.'), true);
11458 + $this->show_form(_('Preferences saved.'), true);
11460 hunk ./actions/smssettings.php 174
11461 - function add_address() {
11462 + function add_address() {
11463 hunk ./actions/smssettings.php 176
11464 - $user = common_current_user();
11465 + $user = common_current_user();
11466 hunk ./actions/smssettings.php 178
11467 - $sms = $this->trimmed('sms');
11468 - $carrier_id = $this->trimmed('carrier');
11470 - # Some validation
11471 + $sms = $this->trimmed('sms');
11472 + $carrier_id = $this->trimmed('carrier');
11474 + # Some validation
11475 hunk ./actions/smssettings.php 183
11477 - $this->show_form(_('No phone number.'));
11481 + $this->show_form(_('No phone number.'));
11484 hunk ./actions/smssettings.php 188
11485 - if (!$carrier_id) {
11486 - $this->show_form(_('No carrier selected.'));
11490 - $sms = common_canonical_sms($sms);
11492 - if ($user->sms == $sms) {
11493 - $this->show_form(_('That is already your phone number.'));
11495 - } else if ($this->sms_exists($sms)) {
11496 - $this->show_form(_('That phone number already belongs to another user.'));
11499 + if (!$carrier_id) {
11500 + $this->show_form(_('No carrier selected.'));
11504 + $sms = common_canonical_sms($sms);
11506 + if ($user->sms == $sms) {
11507 + $this->show_form(_('That is already your phone number.'));
11509 + } else if ($this->sms_exists($sms)) {
11510 + $this->show_form(_('That phone number already belongs to another user.'));
11513 hunk ./actions/smssettings.php 203
11514 - $confirm = new Confirm_address();
11515 - $confirm->address = $sms;
11516 - $confirm->address_extra = $carrier_id;
11517 - $confirm->address_type = 'sms';
11518 - $confirm->user_id = $user->id;
11519 - $confirm->code = common_confirmation_code(40);
11520 + $confirm = new Confirm_address();
11521 + $confirm->address = $sms;
11522 + $confirm->address_extra = $carrier_id;
11523 + $confirm->address_type = 'sms';
11524 + $confirm->user_id = $user->id;
11525 + $confirm->code = common_confirmation_code(40);
11526 hunk ./actions/smssettings.php 210
11527 - $result = $confirm->insert();
11528 + $result = $confirm->insert();
11529 hunk ./actions/smssettings.php 212
11530 - if ($result === FALSE) {
11531 - common_log_db_error($confirm, 'INSERT', __FILE__);
11532 - common_server_error(_('Couldn\'t insert confirmation code.'));
11535 + if ($result === FALSE) {
11536 + common_log_db_error($confirm, 'INSERT', __FILE__);
11537 + common_server_error(_('Couldn\'t insert confirmation code.'));
11540 hunk ./actions/smssettings.php 218
11541 - $carrier = Sms_carrier::staticGet($carrier_id);
11543 - mail_confirm_sms($confirm->code,
11545 - $carrier->toEmailAddress($sms));
11546 + $carrier = Sms_carrier::staticGet($carrier_id);
11548 + mail_confirm_sms($confirm->code,
11550 + $carrier->toEmailAddress($sms));
11551 hunk ./actions/smssettings.php 224
11552 - $msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
11553 + $msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
11554 hunk ./actions/smssettings.php 226
11555 - $this->show_form($msg, TRUE);
11557 + $this->show_form($msg, TRUE);
11559 hunk ./actions/smssettings.php 229
11560 - function cancel_confirmation() {
11562 - $sms = $this->trimmed('sms');
11563 - $carrier = $this->trimmed('carrier');
11565 - $confirm = $this->get_confirmation();
11568 - $this->show_form(_('No pending confirmation to cancel.'));
11571 - if ($confirm->address != $sms) {
11572 - $this->show_form(_('That is the wrong confirmation number.'));
11575 + function cancel_confirmation() {
11577 + $sms = $this->trimmed('sms');
11578 + $carrier = $this->trimmed('carrier');
11580 + $confirm = $this->get_confirmation();
11583 + $this->show_form(_('No pending confirmation to cancel.'));
11586 + if ($confirm->address != $sms) {
11587 + $this->show_form(_('That is the wrong confirmation number.'));
11590 hunk ./actions/smssettings.php 248
11591 - common_log_db_error($confirm, 'DELETE', __FILE__);
11592 + common_log_db_error($confirm, 'DELETE', __FILE__);
11593 hunk ./actions/smssettings.php 254
11596 hunk ./actions/smssettings.php 256
11597 - function remove_address() {
11598 + function remove_address() {
11599 hunk ./actions/smssettings.php 258
11600 - $user = common_current_user();
11601 - $sms = $this->arg('sms');
11602 - $carrier = $this->arg('carrier');
11604 - # Maybe an old tab open...?
11605 + $user = common_current_user();
11606 + $sms = $this->arg('sms');
11607 + $carrier = $this->arg('carrier');
11609 + # Maybe an old tab open...?
11610 hunk ./actions/smssettings.php 264
11611 - if ($user->sms != $sms) {
11612 - $this->show_form(_('That is not your phone number.'));
11615 + if ($user->sms != $sms) {
11616 + $this->show_form(_('That is not your phone number.'));
11619 hunk ./actions/smssettings.php 269
11620 - $user->query('BEGIN');
11621 - $original = clone($user);
11622 - $user->sms = NULL;
11623 - $user->carrier = NULL;
11624 - $user->smsemail = NULL;
11625 - $result = $user->updateKeys($original);
11627 - common_log_db_error($user, 'UPDATE', __FILE__);
11628 - common_server_error(_('Couldn\'t update user.'));
11631 - $user->query('COMMIT');
11632 + $user->query('BEGIN');
11633 + $original = clone($user);
11634 + $user->sms = NULL;
11635 + $user->carrier = NULL;
11636 + $user->smsemail = NULL;
11637 + $result = $user->updateKeys($original);
11639 + common_log_db_error($user, 'UPDATE', __FILE__);
11640 + common_server_error(_('Couldn\'t update user.'));
11643 + $user->query('COMMIT');
11644 hunk ./actions/smssettings.php 282
11645 - $this->show_form(_('The address was removed.'), TRUE);
11648 - function sms_exists($sms) {
11649 - $user = common_current_user();
11650 - $other = User::staticGet('sms', $sms);
11654 - return $other->id != $user->id;
11657 + $this->show_form(_('The address was removed.'), TRUE);
11660 + function sms_exists($sms) {
11661 + $user = common_current_user();
11662 + $other = User::staticGet('sms', $sms);
11666 + return $other->id != $user->id;
11669 hunk ./actions/smssettings.php 295
11670 - function carrier_select() {
11671 - $carrier = new Sms_carrier();
11672 - $cnt = $carrier->find();
11673 + function carrier_select() {
11674 + $carrier = new Sms_carrier();
11675 + $cnt = $carrier->find();
11676 hunk ./actions/smssettings.php 299
11677 - common_element_start('p');
11678 - common_element('label', array('for' => 'carrier'));
11679 - common_element_start('select', array('name' => 'carrier',
11680 - 'id' => 'carrier'));
11681 - common_element('option', array('value' => 0),
11682 - _('Select a carrier'));
11683 - while ($carrier->fetch()) {
11684 - common_element('option', array('value' => $carrier->id),
11687 - common_element_end('select');
11688 - common_element_end('p');
11689 - common_element('span', 'input_instructions',
11690 - sprintf(_('Mobile carrier for your phone. '.
11691 - 'If you know a carrier that accepts ' .
11692 - 'SMS over email but isn\'t listed here, ' .
11693 - 'send email to let us know at %s.'),
11694 - common_config('site', 'email')));
11696 + common_element_start('p');
11697 + common_element('label', array('for' => 'carrier'));
11698 + common_element_start('select', array('name' => 'carrier',
11699 + 'id' => 'carrier'));
11700 + common_element('option', array('value' => 0),
11701 + _('Select a carrier'));
11702 + while ($carrier->fetch()) {
11703 + common_element('option', array('value' => $carrier->id),
11706 + common_element_end('select');
11707 + common_element_end('p');
11708 + common_element('span', 'input_instructions',
11709 + sprintf(_('Mobile carrier for your phone. '.
11710 + 'If you know a carrier that accepts ' .
11711 + 'SMS over email but isn\'t listed here, ' .
11712 + 'send email to let us know at %s.'),
11713 + common_config('site', 'email')));
11715 hunk ./actions/smssettings.php 319
11716 - function confirm_code() {
11718 - $code = $this->trimmed('code');
11721 - $this->show_form(_('No code entered'));
11725 - common_redirect(common_local_url('confirmaddress',
11726 - array('code' => $code)));
11728 + function confirm_code() {
11730 + $code = $this->trimmed('code');
11733 + $this->show_form(_('No code entered'));
11737 + common_redirect(common_local_url('confirmaddress',
11738 + array('code' => $code)));
11740 hunk ./actions/subedit.php 35
11741 - $token = $this->trimmed('token');
11742 + $token = $this->trimmed('token');
11743 hunk ./actions/subedit.php 37
11744 - if (!$token || $token != common_session_token()) {
11745 - $this->client_error(_('There was a problem with your session token. Try again, please.'));
11748 + if (!$token || $token != common_session_token()) {
11749 + $this->client_error(_('There was a problem with your session token. Try again, please.'));
11752 hunk ./actions/subscribe.php 24
11753 - function handle($args) {
11754 - parent::handle($args);
11755 + function handle($args) {
11756 + parent::handle($args);
11757 hunk ./actions/subscribe.php 27
11758 - if (!common_logged_in()) {
11759 - common_user_error(_('Not logged in.'));
11762 + if (!common_logged_in()) {
11763 + common_user_error(_('Not logged in.'));
11766 hunk ./actions/subscribe.php 32
11767 - $user = common_current_user();
11768 + $user = common_current_user();
11769 hunk ./actions/subscribe.php 34
11770 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
11771 - common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
11774 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
11775 + common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
11778 hunk ./actions/subscribe.php 39
11779 - # CSRF protection
11780 + # CSRF protection
11781 hunk ./actions/subscribe.php 41
11782 - $token = $this->trimmed('token');
11783 + $token = $this->trimmed('token');
11784 hunk ./actions/subscribe.php 43
11785 - if (!$token || $token != common_session_token()) {
11786 - $this->client_error(_('There was a problem with your session token. Try again, please.'));
11789 + if (!$token || $token != common_session_token()) {
11790 + $this->client_error(_('There was a problem with your session token. Try again, please.'));
11793 hunk ./actions/subscribe.php 48
11794 - $other_id = $this->arg('subscribeto');
11795 + $other_id = $this->arg('subscribeto');
11796 hunk ./actions/subscribe.php 53
11797 - $this->client_error(_('Not a local user.'));
11799 + $this->client_error(_('Not a local user.'));
11801 hunk ./actions/subscribe.php 57
11802 - $result = subs_subscribe_to($user, $other);
11803 + $result = subs_subscribe_to($user, $other);
11804 hunk ./actions/subscribe.php 59
11805 - if($result != true) {
11806 - common_user_error($result);
11809 + if($result != true) {
11810 + common_user_error($result);
11813 hunk ./actions/subscribe.php 64
11814 - if ($this->boolean('ajax')) {
11815 - common_start_html('text/xml;charset=utf-8', true);
11816 - common_element_start('head');
11817 - common_element('title', null, _('Subscribed'));
11818 - common_element_end('head');
11819 - common_element_start('body');
11820 - common_unsubscribe_form($other->getProfile());
11821 - common_element_end('body');
11822 - common_element_end('html');
11824 - common_redirect(common_local_url('subscriptions', array('nickname' =>
11825 - $user->nickname)));
11826 + if ($this->boolean('ajax')) {
11827 + common_start_html('text/xml;charset=utf-8', true);
11828 + common_element_start('head');
11829 + common_element('title', null, _('Subscribed'));
11830 + common_element_end('head');
11831 + common_element_start('body');
11832 + common_unsubscribe_form($other->getProfile());
11833 + common_element_end('body');
11834 + common_element_end('html');
11836 + common_redirect(common_local_url('subscriptions', array('nickname' =>
11837 + $user->nickname)));
11838 hunk ./actions/subscribe.php 77
11841 hunk ./actions/subscribers.php 26
11842 - function gallery_type() {
11843 - return _('Subscribers');
11845 + function gallery_type() {
11846 + return _('Subscribers');
11848 hunk ./actions/subscribers.php 30
11849 - function get_instructions(&$profile) {
11850 - $user =& common_current_user();
11851 - if ($user && ($user->id == $profile->id)) {
11852 - return _('These are the people who listen to your notices.');
11854 - return sprintf(_('These are the people who listen to %s\'s notices.'), $profile->nickname);
11857 + function get_instructions(&$profile) {
11858 + $user =& common_current_user();
11859 + if ($user && ($user->id == $profile->id)) {
11860 + return _('These are the people who listen to your notices.');
11862 + return sprintf(_('These are the people who listen to %s\'s notices.'), $profile->nickname);
11865 hunk ./actions/subscribers.php 39
11866 - function fields() {
11867 - return array('subscriber', 'subscribed');
11869 + function fields() {
11870 + return array('subscriber', 'subscribed');
11872 hunk ./actions/subscribers.php 43
11873 - function div_class() {
11874 - return 'subscribers';
11876 + function div_class() {
11877 + return 'subscribers';
11879 hunk ./actions/subscribers.php 47
11880 - function get_other(&$subs) {
11881 - return $subs->subscriber;
11883 + function get_other(&$subs) {
11884 + return $subs->subscriber;
11886 hunk ./actions/subscriptions.php 26
11887 - function gallery_type() {
11888 - return _('Subscriptions');
11890 + function gallery_type() {
11891 + return _('Subscriptions');
11893 hunk ./actions/subscriptions.php 30
11894 - function get_instructions(&$profile) {
11895 - $user =& common_current_user();
11896 - if ($user && ($user->id == $profile->id)) {
11897 - return _('These are the people whose notices you listen to.');
11899 - return sprintf(_('These are the people whose notices %s listens to.'), $profile->nickname);
11902 + function get_instructions(&$profile) {
11903 + $user =& common_current_user();
11904 + if ($user && ($user->id == $profile->id)) {
11905 + return _('These are the people whose notices you listen to.');
11907 + return sprintf(_('These are the people whose notices %s listens to.'), $profile->nickname);
11910 hunk ./actions/subscriptions.php 39
11911 - function fields() {
11912 - return array('subscribed', 'subscriber');
11914 + function fields() {
11915 + return array('subscribed', 'subscriber');
11917 hunk ./actions/subscriptions.php 43
11918 - function div_class() {
11919 - return 'subscriptions';
11921 + function div_class() {
11922 + return 'subscriptions';
11924 hunk ./actions/subscriptions.php 47
11925 - function get_other(&$subs) {
11926 - return $subs->subscribed;
11928 + function get_other(&$subs) {
11929 + return $subs->subscribed;
11931 hunk ./actions/subscriptions.php 60
11932 - $sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id,
11933 - 'subscribed' => $profile->id));
11934 + $sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id,
11935 + 'subscribed' => $profile->id));
11936 hunk ./actions/sup.php 23
11938 - function handle($args) {
11940 - parent::handle($args);
11942 - $seconds = $this->trimmed('seconds');
11948 + function handle($args) {
11950 + parent::handle($args);
11952 + $seconds = $this->trimmed('seconds');
11957 hunk ./actions/sup.php 34
11958 - $updates = $this->get_updates($seconds);
11960 - header('Content-Type: application/json; charset=utf-8');
11962 - print json_encode(array('updated_time' => date('c'),
11963 - 'since_time' => date('c', time() - $seconds),
11964 - 'available_periods' => $this->available_periods(),
11965 - 'period' => $seconds,
11966 - 'updates' => $updates));
11969 - function available_periods() {
11970 - static $periods = array(86400, 43200, 21600, 7200,
11971 - 3600, 1800, 600, 300, 120,
11973 - $available = array();
11974 - foreach ($periods as $period) {
11975 - $available[$period] = common_local_url('sup',
11976 - array('seconds' => $period));
11979 - return $available;
11982 - function get_updates($seconds) {
11983 - $notice = new Notice();
11984 + $updates = $this->get_updates($seconds);
11986 + header('Content-Type: application/json; charset=utf-8');
11988 + print json_encode(array('updated_time' => date('c'),
11989 + 'since_time' => date('c', time() - $seconds),
11990 + 'available_periods' => $this->available_periods(),
11991 + 'period' => $seconds,
11992 + 'updates' => $updates));
11995 + function available_periods() {
11996 + static $periods = array(86400, 43200, 21600, 7200,
11997 + 3600, 1800, 600, 300, 120,
11999 + $available = array();
12000 + foreach ($periods as $period) {
12001 + $available[$period] = common_local_url('sup',
12002 + array('seconds' => $period));
12005 + return $available;
12008 + function get_updates($seconds) {
12009 + $notice = new Notice();
12010 hunk ./actions/sup.php 61
12011 - # XXX: cache this. Depends on how big this protocol becomes;
12012 - # Re-doing this query every 15 seconds isn't the end of the world.
12013 + # XXX: cache this. Depends on how big this protocol becomes;
12014 + # Re-doing this query every 15 seconds isn't the end of the world.
12015 hunk ./actions/sup.php 64
12016 - $notice->query('SELECT profile_id, max(id) AS max_id ' .
12018 - 'WHERE created > (now() - ' . $seconds . ') ' .
12019 - 'GROUP BY profile_id');
12021 - $updates = array();
12023 - while ($notice->fetch()) {
12024 - $updates[] = array($notice->profile_id, $notice->max_id);
12030 - function is_readonly() {
12033 + $notice->query('SELECT profile_id, max(id) AS max_id ' .
12035 + 'WHERE created > (now() - ' . $seconds . ') ' .
12036 + 'GROUP BY profile_id');
12038 + $updates = array();
12040 + while ($notice->fetch()) {
12041 + $updates[] = array($notice->profile_id, $notice->max_id);
12047 + function is_readonly() {
12050 hunk ./actions/tag.php 27
12051 - function handle($args) {
12052 + function handle($args) {
12053 hunk ./actions/tag.php 29
12054 - parent::handle($args);
12055 + parent::handle($args);
12056 hunk ./actions/tag.php 31
12057 - # Looks like we're good; show the header
12058 + # Looks like we're good; show the header
12059 hunk ./actions/tag.php 33
12060 - if (isset($args['tag']) && $args['tag']) {
12061 - $tag = $args['tag'];
12062 - common_show_header(sprintf(_("Notices tagged with %s"), $tag),
12063 - array($this, 'show_header'), $tag,
12064 - array($this, 'show_top'));
12065 - $this->show_notices($tag);
12067 - common_show_header(_("Tags"),
12068 - array($this, 'show_header'), '',
12069 - array($this, 'show_top'));
12070 - $this->show_tags();
12072 + if (isset($args['tag']) && $args['tag']) {
12073 + $tag = $args['tag'];
12074 + common_show_header(sprintf(_("Notices tagged with %s"), $tag),
12075 + array($this, 'show_header'), $tag,
12076 + array($this, 'show_top'));
12077 + $this->show_notices($tag);
12079 + common_show_header(_("Tags"),
12080 + array($this, 'show_header'), '',
12081 + array($this, 'show_top'));
12082 + $this->show_tags();
12084 hunk ./actions/tag.php 46
12085 - common_show_footer();
12087 + common_show_footer();
12089 hunk ./actions/tag.php 49
12090 - function show_header($tag = false) {
12092 - common_element('link', array('rel' => 'alternate',
12093 - 'href' => common_local_url('tagrss', array('tag' => $tag)),
12094 - 'type' => 'application/rss+xml',
12095 - 'title' => sprintf(_('Feed for tag %s'), $tag)));
12098 + function show_header($tag = false) {
12100 + common_element('link', array('rel' => 'alternate',
12101 + 'href' => common_local_url('tagrss', array('tag' => $tag)),
12102 + 'type' => 'application/rss+xml',
12103 + 'title' => sprintf(_('Feed for tag %s'), $tag)));
12106 hunk ./actions/tag.php 58
12107 - function get_instructions() {
12108 - return _('Showing most popular tags from the last week');
12110 + function get_instructions() {
12111 + return _('Showing most popular tags from the last week');
12113 hunk ./actions/tag.php 62
12114 - function show_top($tag = false) {
12116 - $instr = $this->get_instructions();
12117 - $output = common_markup_to_html($instr);
12118 - common_element_start('div', 'instructions');
12119 - common_raw($output);
12120 - common_element_end('div');
12121 - $this->public_views_menu();
12124 - $this->show_feeds_list(array(0=>array('href'=>common_local_url('tagrss'),
12126 - 'version' => 'RSS 1.0',
12127 - 'item' => 'tagrss')));
12130 + function show_top($tag = false) {
12132 + $instr = $this->get_instructions();
12133 + $output = common_markup_to_html($instr);
12134 + common_element_start('div', 'instructions');
12135 + common_raw($output);
12136 + common_element_end('div');
12137 + $this->public_views_menu();
12140 + $this->show_feeds_list(array(0=>array('href'=>common_local_url('tagrss'),
12142 + 'version' => 'RSS 1.0',
12143 + 'item' => 'tagrss')));
12146 hunk ./actions/tag.php 79
12147 - function show_tags()
12149 - # This should probably be cached rather than recalculated
12150 - $tags = DB_DataObject::factory('Notice_tag');
12151 + function show_tags()
12153 + # This should probably be cached rather than recalculated
12154 + $tags = DB_DataObject::factory('Notice_tag');
12155 hunk ./actions/tag.php 84
12156 - #Need to clear the selection and then only re-add the field
12157 - #we are grouping by, otherwise it's not a valid 'group by'
12158 - #even though MySQL seems to let it slide...
12159 - $tags->selectAdd();
12160 - $tags->selectAdd('tag');
12161 + #Need to clear the selection and then only re-add the field
12162 + #we are grouping by, otherwise it's not a valid 'group by'
12163 + #even though MySQL seems to let it slide...
12164 + $tags->selectAdd();
12165 + $tags->selectAdd('tag');
12166 hunk ./actions/tag.php 90
12167 - #Add the aggregated columns...
12168 - $tags->selectAdd('max(notice_id) as last_notice_id');
12169 - if(common_config('db','type')=='pgsql') {
12170 - $calc='sum(exp(-extract(epoch from (now()-created))/%s)) as weight';
12172 - $calc='sum(exp(-(now() - created)/%s)) as weight';
12174 - $tags->selectAdd(sprintf($calc, common_config('tag', 'dropoff')));
12175 - $tags->groupBy('tag');
12176 - $tags->orderBy('weight DESC');
12177 + #Add the aggregated columns...
12178 + $tags->selectAdd('max(notice_id) as last_notice_id');
12179 + if(common_config('db','type')=='pgsql') {
12180 + $calc='sum(exp(-extract(epoch from (now()-created))/%s)) as weight';
12182 + $calc='sum(exp(-(now() - created)/%s)) as weight';
12184 + $tags->selectAdd(sprintf($calc, common_config('tag', 'dropoff')));
12185 + $tags->groupBy('tag');
12186 + $tags->orderBy('weight DESC');
12187 hunk ./actions/tag.php 101
12188 - # $tags->whereAdd('created > "' . strftime('%Y-%m-%d %H:%M:%S', strtotime('-1 MONTH')) . '"');
12189 + # $tags->whereAdd('created > "' . strftime('%Y-%m-%d %H:%M:%S', strtotime('-1 MONTH')) . '"');
12190 hunk ./actions/tag.php 103
12191 - $tags->limit(TAGS_PER_PAGE);
12192 + $tags->limit(TAGS_PER_PAGE);
12193 hunk ./actions/tag.php 105
12194 - $cnt = $tags->find();
12195 + $cnt = $tags->find();
12196 hunk ./actions/tag.php 107
12198 - common_element_start('p', 'tagcloud');
12200 + common_element_start('p', 'tagcloud');
12201 hunk ./actions/tag.php 110
12204 - while ($tags->fetch()) {
12205 - $tw[$tags->tag] = $tags->weight;
12206 - $sum += $tags->weight;
12210 + while ($tags->fetch()) {
12211 + $tw[$tags->tag] = $tags->weight;
12212 + $sum += $tags->weight;
12214 hunk ./actions/tag.php 117
12217 hunk ./actions/tag.php 119
12218 - foreach ($tw as $tag => $weight) {
12219 - $this->show_tag($tag, $weight, $weight/$sum);
12221 + foreach ($tw as $tag => $weight) {
12222 + $this->show_tag($tag, $weight, $weight/$sum);
12224 hunk ./actions/tag.php 123
12225 - common_element_end('p');
12228 + common_element_end('p');
12231 hunk ./actions/tag.php 127
12232 - function show_tag($tag, $weight, $relative) {
12233 + function show_tag($tag, $weight, $relative) {
12234 hunk ./actions/tag.php 129
12235 - # XXX: these should probably tune to the size of the site
12236 - if ($relative > 0.1) {
12237 - $cls = 'largest';
12238 - } else if ($relative > 0.05) {
12239 - $cls = 'verylarge';
12240 - } else if ($relative > 0.02) {
12242 - } else if ($relative > 0.01) {
12244 - } else if ($relative > 0.005) {
12246 - } else if ($relative > 0.002) {
12247 - $cls = 'verysmall';
12249 - $cls = 'smallest';
12251 + # XXX: these should probably tune to the size of the site
12252 + if ($relative > 0.1) {
12253 + $cls = 'largest';
12254 + } else if ($relative > 0.05) {
12255 + $cls = 'verylarge';
12256 + } else if ($relative > 0.02) {
12258 + } else if ($relative > 0.01) {
12260 + } else if ($relative > 0.005) {
12262 + } else if ($relative > 0.002) {
12263 + $cls = 'verysmall';
12265 + $cls = 'smallest';
12267 hunk ./actions/tag.php 146
12268 - common_element('a', array('class' => "$cls weight-$weight relative-$relative",
12269 - 'href' => common_local_url('tag', array('tag' => $tag))),
12271 - common_text(' ');
12273 + common_element('a', array('class' => "$cls weight-$weight relative-$relative",
12274 + 'href' => common_local_url('tag', array('tag' => $tag))),
12276 + common_text(' ');
12278 hunk ./actions/tag.php 152
12279 - function show_notices($tag) {
12280 + function show_notices($tag) {
12281 hunk ./actions/tag.php 154
12284 hunk ./actions/tag.php 156
12285 - $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
12286 + $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
12287 hunk ./actions/tag.php 158
12288 - $notice = Notice_tag::getStream($tag, (($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
12289 + $notice = Notice_tag::getStream($tag, (($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
12290 hunk ./actions/tag.php 162
12291 - common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
12292 - $page, 'tag', array('tag' => $tag));
12294 + common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
12295 + $page, 'tag', array('tag' => $tag));
12297 hunk ./actions/tagother.php 26
12298 - function handle($args) {
12299 + function handle($args) {
12300 hunk ./actions/tagother.php 28
12301 - parent::handle($args);
12302 + parent::handle($args);
12303 hunk ./actions/tagother.php 30
12304 - if (!common_logged_in()) {
12305 - $this->client_error(_('Not logged in'), 403);
12308 + if (!common_logged_in()) {
12309 + $this->client_error(_('Not logged in'), 403);
12312 hunk ./actions/tagother.php 35
12313 - if ($_SERVER['REQUEST_METHOD'] == 'POST') {
12314 - $this->save_tags();
12316 - $id = $this->trimmed('id');
12318 - $this->client_error(_('No id argument.'));
12321 - $profile = Profile::staticGet('id', $id);
12323 - $this->client_error(_('No profile with that ID.'));
12326 - $this->show_form($profile);
12329 + if ($_SERVER['REQUEST_METHOD'] == 'POST') {
12330 + $this->save_tags();
12332 + $id = $this->trimmed('id');
12334 + $this->client_error(_('No id argument.'));
12337 + $profile = Profile::staticGet('id', $id);
12339 + $this->client_error(_('No profile with that ID.'));
12342 + $this->show_form($profile);
12345 hunk ./actions/tagother.php 52
12346 - function show_form($profile, $error=NULL) {
12347 + function show_form($profile, $error=NULL) {
12348 hunk ./actions/tagother.php 54
12349 - $user = common_current_user();
12350 + $user = common_current_user();
12351 hunk ./actions/tagother.php 56
12352 - common_show_header(_('Tag a person'),
12353 - NULL, array($profile, $error), array($this, 'show_top'));
12354 + common_show_header(_('Tag a person'),
12355 + NULL, array($profile, $error), array($this, 'show_top'));
12356 hunk ./actions/tagother.php 59
12357 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
12358 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
12359 hunk ./actions/tagother.php 61
12360 - common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
12361 - 'class' => 'avatar stream',
12362 - 'width' => AVATAR_PROFILE_SIZE,
12363 - 'height' => AVATAR_PROFILE_SIZE,
12365 - ($profile->fullname) ? $profile->fullname :
12366 - $profile->nickname));
12367 + common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
12368 + 'class' => 'avatar stream',
12369 + 'width' => AVATAR_PROFILE_SIZE,
12370 + 'height' => AVATAR_PROFILE_SIZE,
12372 + ($profile->fullname) ? $profile->fullname :
12373 + $profile->nickname));
12374 hunk ./actions/tagother.php 69
12375 - common_element('a', array('href' => $profile->profileurl,
12376 - 'class' => 'external profile nickname'),
12377 - $profile->nickname);
12378 + common_element('a', array('href' => $profile->profileurl,
12379 + 'class' => 'external profile nickname'),
12380 + $profile->nickname);
12381 hunk ./actions/tagother.php 73
12382 - if ($profile->fullname) {
12383 - common_element_start('div', 'fullname');
12384 - if ($profile->homepage) {
12385 - common_element('a', array('href' => $profile->homepage),
12386 - $profile->fullname);
12388 - common_text($profile->fullname);
12390 - common_element_end('div');
12392 - if ($profile->location) {
12393 - common_element('div', 'location', $profile->location);
12395 - if ($profile->bio) {
12396 - common_element('div', 'bio', $profile->bio);
12398 + if ($profile->fullname) {
12399 + common_element_start('div', 'fullname');
12400 + if ($profile->homepage) {
12401 + common_element('a', array('href' => $profile->homepage),
12402 + $profile->fullname);
12404 + common_text($profile->fullname);
12406 + common_element_end('div');
12408 + if ($profile->location) {
12409 + common_element('div', 'location', $profile->location);
12411 + if ($profile->bio) {
12412 + common_element('div', 'bio', $profile->bio);
12414 hunk ./actions/tagother.php 90
12415 - common_element_start('form', array('method' => 'post',
12416 - 'id' => 'tag_user',
12417 - 'name' => 'tagother',
12418 - 'action' => $this->self_url()));
12419 - common_hidden('token', common_session_token());
12420 - common_hidden('id', $profile->id);
12421 - common_input('tags', _('Tags'),
12422 - ($this->arg('tags')) ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $profile->id)),
12423 - _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
12424 + common_element_start('form', array('method' => 'post',
12425 + 'id' => 'tag_user',
12426 + 'name' => 'tagother',
12427 + 'action' => $this->self_url()));
12428 + common_hidden('token', common_session_token());
12429 + common_hidden('id', $profile->id);
12430 + common_input('tags', _('Tags'),
12431 + ($this->arg('tags')) ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $profile->id)),
12432 + _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
12433 hunk ./actions/tagother.php 100
12434 - common_submit('save', _('Save'));
12435 - common_element_end('form');
12436 - common_show_footer();
12437 + common_submit('save', _('Save'));
12438 + common_element_end('form');
12439 + common_show_footer();
12440 hunk ./actions/tagother.php 104
12443 hunk ./actions/tagother.php 106
12444 - function save_tags() {
12445 + function save_tags() {
12446 hunk ./actions/tagother.php 108
12447 - $id = $this->trimmed('id');
12448 - $tagstring = $this->trimmed('tags');
12449 - $token = $this->trimmed('token');
12450 + $id = $this->trimmed('id');
12451 + $tagstring = $this->trimmed('tags');
12452 + $token = $this->trimmed('token');
12453 hunk ./actions/tagother.php 112
12454 - if (!$token || $token != common_session_token()) {
12455 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
12458 + if (!$token || $token != common_session_token()) {
12459 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
12462 hunk ./actions/tagother.php 117
12463 - $profile = Profile::staticGet('id', $id);
12464 + $profile = Profile::staticGet('id', $id);
12465 hunk ./actions/tagother.php 119
12467 - $this->client_error(_('No such profile.'));
12471 + $this->client_error(_('No such profile.'));
12474 hunk ./actions/tagother.php 124
12475 - if (is_string($tagstring) && strlen($tagstring) > 0) {
12476 + if (is_string($tagstring) && strlen($tagstring) > 0) {
12477 hunk ./actions/tagother.php 126
12478 - $tags = array_map('common_canonical_tag',
12479 - preg_split('/[\s,]+/', $tagstring));
12480 + $tags = array_map('common_canonical_tag',
12481 + preg_split('/[\s,]+/', $tagstring));
12482 hunk ./actions/tagother.php 129
12483 - foreach ($tags as $tag) {
12484 - if (!common_valid_profile_tag($tag)) {
12485 - $this->show_form($profile, sprintf(_('Invalid tag: "%s"'), $tag));
12492 + foreach ($tags as $tag) {
12493 + if (!common_valid_profile_tag($tag)) {
12494 + $this->show_form($profile, sprintf(_('Invalid tag: "%s"'), $tag));
12501 hunk ./actions/tagother.php 139
12502 - $user = common_current_user();
12503 + $user = common_current_user();
12504 hunk ./actions/tagother.php 141
12505 - if (!Subscription::pkeyGet(array('subscriber' => $user->id,
12506 - 'subscribed' => $profile->id)) &&
12507 - !Subscription::pkeyGet(array('subscriber' => $profile->id,
12508 - 'subscribed' => $user->id)))
12510 - $this->client_error(_('You can only tag people you are subscribed to or who are subscribed to you.'));
12513 + if (!Subscription::pkeyGet(array('subscriber' => $user->id,
12514 + 'subscribed' => $profile->id)) &&
12515 + !Subscription::pkeyGet(array('subscriber' => $profile->id,
12516 + 'subscribed' => $user->id)))
12518 + $this->client_error(_('You can only tag people you are subscribed to or who are subscribed to you.'));
12521 hunk ./actions/tagother.php 150
12522 - $result = Profile_tag::setTags($user->id, $profile->id, $tags);
12523 + $result = Profile_tag::setTags($user->id, $profile->id, $tags);
12524 hunk ./actions/tagother.php 152
12526 - $this->client_error(_('Could not save tags.'));
12530 + $this->client_error(_('Could not save tags.'));
12533 hunk ./actions/tagother.php 157
12534 - $action = $user->isSubscribed($profile) ? 'subscriptions' : 'subscribers';
12535 + $action = $user->isSubscribed($profile) ? 'subscriptions' : 'subscribers';
12536 hunk ./actions/tagother.php 159
12537 - if ($this->boolean('ajax')) {
12538 - common_start_html('text/xml');
12539 - common_element_start('head');
12540 - common_element('title', null, _('Tags'));
12541 - common_element_end('head');
12542 - common_element_start('body');
12543 - common_element_start('p', 'subtags');
12544 - foreach ($tags as $tag) {
12545 - common_element('a', array('href' => common_local_url($action,
12546 - array('nickname' => $user->nickname,
12547 - 'tag' => $tag))),
12550 - common_element_end('p');
12551 - common_element_end('body');
12552 - common_element_end('html');
12554 - common_redirect(common_local_url($action, array('nickname' =>
12555 - $user->nickname)));
12556 + if ($this->boolean('ajax')) {
12557 + common_start_html('text/xml');
12558 + common_element_start('head');
12559 + common_element('title', null, _('Tags'));
12560 + common_element_end('head');
12561 + common_element_start('body');
12562 + common_element_start('p', 'subtags');
12563 + foreach ($tags as $tag) {
12564 + common_element('a', array('href' => common_local_url($action,
12565 + array('nickname' => $user->nickname,
12566 + 'tag' => $tag))),
12569 + common_element_end('p');
12570 + common_element_end('body');
12571 + common_element_end('html');
12573 + common_redirect(common_local_url($action, array('nickname' =>
12574 + $user->nickname)));
12575 hunk ./actions/tagother.php 179
12578 hunk ./actions/tagother.php 181
12579 - function show_top($arr = NULL) {
12580 - list($profile, $error) = $arr;
12582 - common_element('p', 'error', $error);
12584 - common_element_start('div', 'instructions');
12585 - common_element('p', NULL,
12586 - _('Use this form to add tags to your subscribers or subscriptions.'));
12587 - common_element_end('div');
12590 + function show_top($arr = NULL) {
12591 + list($profile, $error) = $arr;
12593 + common_element('p', 'error', $error);
12595 + common_element_start('div', 'instructions');
12596 + common_element('p', NULL,
12597 + _('Use this form to add tags to your subscribers or subscriptions.'));
12598 + common_element_end('div');
12601 hunk ./actions/tagrss.php 28
12602 - function init() {
12603 - $tag = $this->trimmed('tag');
12604 - $this->tag = Notice_tag::staticGet('tag', $tag);
12605 + function init() {
12606 + $tag = $this->trimmed('tag');
12607 + $this->tag = Notice_tag::staticGet('tag', $tag);
12608 hunk ./actions/tagrss.php 32
12609 - if (!$this->tag) {
12610 - common_user_error(_('No such tag.'));
12616 + if (!$this->tag) {
12617 + common_user_error(_('No such tag.'));
12623 hunk ./actions/tagrss.php 40
12624 - function get_notices($limit=0) {
12625 - $tag = $this->tag;
12626 + function get_notices($limit=0) {
12627 + $tag = $this->tag;
12628 hunk ./actions/tagrss.php 43
12629 - if (is_null($tag)) {
12632 + if (is_null($tag)) {
12635 hunk ./actions/tagrss.php 47
12636 - $notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
12637 + $notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
12638 hunk ./actions/tagrss.php 49
12639 - while ($notice->fetch()) {
12640 - $notices[] = clone($notice);
12642 + while ($notice->fetch()) {
12643 + $notices[] = clone($notice);
12645 hunk ./actions/tagrss.php 53
12650 hunk ./actions/tagrss.php 56
12651 - function get_channel() {
12652 - $tag = $this->tag->tag;
12653 + function get_channel() {
12654 + $tag = $this->tag->tag;
12655 hunk ./actions/tagrss.php 59
12656 - $c = array('url' => common_local_url('tagrss', array('tag' => $tagname)),
12657 - 'title' => $tagname,
12658 - 'link' => common_local_url('tagrss', array('tag' => $tagname)),
12659 - 'description' => sprintf(_('Microblog tagged with %s'), $tagname));
12662 + $c = array('url' => common_local_url('tagrss', array('tag' => $tagname)),
12663 + 'title' => $tagname,
12664 + 'link' => common_local_url('tagrss', array('tag' => $tagname)),
12665 + 'description' => sprintf(_('Microblog tagged with %s'), $tagname));
12668 hunk ./actions/twitapiaccount.php 26
12669 - function verify_credentials($args, $apidata) {
12670 - parent::handle($args);
12671 + function verify_credentials($args, $apidata) {
12672 + parent::handle($args);
12673 hunk ./actions/twitapiaccount.php 29
12674 - if (!in_array($apidata['content-type'], array('xml', 'json'))) {
12675 - common_user_error(_('API method not found!'), $code = 404);
12678 + if (!in_array($apidata['content-type'], array('xml', 'json'))) {
12679 + common_user_error(_('API method not found!'), $code = 404);
12682 hunk ./actions/twitapiaccount.php 34
12683 - $this->show_extended_profile($apidata['user'], $apidata);
12685 + $this->show_extended_profile($apidata['user'], $apidata);
12687 hunk ./actions/twitapiaccount.php 37
12688 - function end_session($args, $apidata) {
12689 - parent::handle($args);
12690 - common_server_error(_('API method under construction.'), $code=501);
12692 + function end_session($args, $apidata) {
12693 + parent::handle($args);
12694 + common_server_error(_('API method under construction.'), $code=501);
12696 hunk ./actions/twitapiaccount.php 42
12697 - function update_location($args, $apidata) {
12698 - parent::handle($args);
12699 + function update_location($args, $apidata) {
12700 + parent::handle($args);
12701 hunk ./actions/twitapiaccount.php 45
12702 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
12703 - $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
12706 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
12707 + $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
12710 hunk ./actions/twitapiaccount.php 50
12711 - $location = trim($this->arg('location'));
12712 + $location = trim($this->arg('location'));
12713 hunk ./actions/twitapiaccount.php 52
12714 - if (!is_null($location) && strlen($location) > 255) {
12715 + if (!is_null($location) && strlen($location) > 255) {
12716 hunk ./actions/twitapiaccount.php 54
12717 - // XXX: But Twitter just truncates and runs with it. -- Zach
12718 - $this->client_error(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
12721 + // XXX: But Twitter just truncates and runs with it. -- Zach
12722 + $this->client_error(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
12725 hunk ./actions/twitapiaccount.php 59
12726 - $user = $apidata['user'];
12727 - $profile = $user->getProfile();
12728 + $user = $apidata['user'];
12729 + $profile = $user->getProfile();
12730 hunk ./actions/twitapiaccount.php 62
12732 - common_server_error(_('User has no profile.'));
12736 + common_server_error(_('User has no profile.'));
12739 hunk ./actions/twitapiaccount.php 67
12740 - $orig_profile = clone($profile);
12741 - $profile->location = $location;
12742 + $orig_profile = clone($profile);
12743 + $profile->location = $location;
12744 hunk ./actions/twitapiaccount.php 70
12745 - $result = $profile->update($orig_profile);
12746 + $result = $profile->update($orig_profile);
12747 hunk ./actions/twitapiaccount.php 72
12749 - common_log_db_error($profile, 'UPDATE', __FILE__);
12750 - common_server_error(_('Couldn\'t save profile.'));
12754 + common_log_db_error($profile, 'UPDATE', __FILE__);
12755 + common_server_error(_('Couldn\'t save profile.'));
12758 hunk ./actions/twitapiaccount.php 78
12759 - common_broadcast_profile($profile);
12760 - $type = $apidata['content-type'];
12761 + common_broadcast_profile($profile);
12762 + $type = $apidata['content-type'];
12763 hunk ./actions/twitapiaccount.php 81
12764 - $this->init_document($type);
12765 - $this->show_profile($profile, $type);
12766 - $this->end_document($type);
12768 + $this->init_document($type);
12769 + $this->show_profile($profile, $type);
12770 + $this->end_document($type);
12772 hunk ./actions/twitapiaccount.php 87
12773 - function update_delivery_device($args, $apidata) {
12774 - parent::handle($args);
12775 - common_server_error(_('API method under construction.'), $code=501);
12777 + function update_delivery_device($args, $apidata) {
12778 + parent::handle($args);
12779 + common_server_error(_('API method under construction.'), $code=501);
12781 hunk ./actions/twitapiaccount.php 92
12782 - function rate_limit_status($args, $apidata) {
12783 - parent::handle($args);
12784 - common_server_error(_('API method under construction.'), $code=501);
12786 + function rate_limit_status($args, $apidata) {
12787 + parent::handle($args);
12788 + common_server_error(_('API method under construction.'), $code=501);
12790 hunk ./actions/twitapiblocks.php 26
12791 - function create($args, $apidata) {
12792 + function create($args, $apidata) {
12793 hunk ./actions/twitapiblocks.php 28
12794 - parent::handle($args);
12795 + parent::handle($args);
12796 hunk ./actions/twitapiblocks.php 30
12797 - $blockee = $this->get_user($apidata['api_arg'], $apidata);
12798 + $blockee = $this->get_user($apidata['api_arg'], $apidata);
12799 hunk ./actions/twitapiblocks.php 33
12800 - $this->client_error('Not Found', 404, $apidata['content-type']);
12802 + $this->client_error('Not Found', 404, $apidata['content-type']);
12804 hunk ./actions/twitapiblocks.php 45
12805 - common_server_error(_('Block user failed.'));
12806 + common_server_error(_('Block user failed.'));
12807 hunk ./actions/twitapiblocks.php 47
12810 hunk ./actions/twitapiblocks.php 49
12811 - function destroy($args, $apidata) {
12812 - parent::handle($args);
12813 - $blockee = $this->get_user($apidata['api_arg'], $apidata);
12814 + function destroy($args, $apidata) {
12815 + parent::handle($args);
12816 + $blockee = $this->get_user($apidata['api_arg'], $apidata);
12817 hunk ./actions/twitapiblocks.php 54
12818 - $this->client_error('Not Found', 404, $apidata['content-type']);
12820 + $this->client_error('Not Found', 404, $apidata['content-type']);
12822 hunk ./actions/twitapiblocks.php 66
12823 - common_server_error(_('Unblock user failed.'));
12824 + common_server_error(_('Unblock user failed.'));
12825 hunk ./actions/twitapiblocks.php 68
12828 hunk ./actions/twitapidirect_messages.php 26
12829 - function direct_messages($args, $apidata) {
12830 - parent::handle($args);
12831 - return $this->show_messages($args, $apidata, 'received');
12833 + function direct_messages($args, $apidata) {
12834 + parent::handle($args);
12835 + return $this->show_messages($args, $apidata, 'received');
12837 hunk ./actions/twitapidirect_messages.php 31
12838 - function sent($args, $apidata) {
12839 - parent::handle($args);
12840 - return $this->show_messages($args, $apidata, 'sent');
12842 + function sent($args, $apidata) {
12843 + parent::handle($args);
12844 + return $this->show_messages($args, $apidata, 'sent');
12846 hunk ./actions/twitapidirect_messages.php 36
12847 - function show_messages($args, $apidata, $type) {
12848 + function show_messages($args, $apidata, $type) {
12849 hunk ./actions/twitapidirect_messages.php 38
12850 - $user = $apidata['user'];
12851 + $user = $apidata['user'];
12852 hunk ./actions/twitapidirect_messages.php 40
12853 - $count = $this->arg('count');
12854 - $since = $this->arg('since');
12855 - $since_id = $this->arg('since_id');
12856 - $before_id = $this->arg('before_id');
12857 + $count = $this->arg('count');
12858 + $since = $this->arg('since');
12859 + $since_id = $this->arg('since_id');
12860 + $before_id = $this->arg('before_id');
12861 hunk ./actions/twitapidirect_messages.php 45
12862 - $page = $this->arg('page');
12863 + $page = $this->arg('page');
12864 hunk ./actions/twitapidirect_messages.php 47
12871 hunk ./actions/twitapidirect_messages.php 51
12878 hunk ./actions/twitapidirect_messages.php 55
12879 - $message = new Message();
12880 + $message = new Message();
12881 hunk ./actions/twitapidirect_messages.php 57
12883 - $subtitle = null;
12885 - $server = common_root_url();
12887 + $subtitle = null;
12889 + $server = common_root_url();
12890 hunk ./actions/twitapidirect_messages.php 62
12891 - if ($type == 'received') {
12892 - $message->to_profile = $user->id;
12893 - $title = sprintf(_("Direct messages to %s"), $user->nickname);
12894 - $subtitle = sprintf(_("All the direct messages sent to %s"), $user->nickname);
12895 - $link = $server . $user->nickname . '/inbox';
12897 - $message->from_profile = $user->id;
12898 - $title = _('Direct Messages You\'ve Sent');
12899 - $subtitle = sprintf(_("All the direct messages sent from %s"), $user->nickname);
12900 - $link = $server . $user->nickname . '/outbox';
12902 + if ($type == 'received') {
12903 + $message->to_profile = $user->id;
12904 + $title = sprintf(_("Direct messages to %s"), $user->nickname);
12905 + $subtitle = sprintf(_("All the direct messages sent to %s"), $user->nickname);
12906 + $link = $server . $user->nickname . '/inbox';
12908 + $message->from_profile = $user->id;
12909 + $title = _('Direct Messages You\'ve Sent');
12910 + $subtitle = sprintf(_("All the direct messages sent from %s"), $user->nickname);
12911 + $link = $server . $user->nickname . '/outbox';
12913 hunk ./actions/twitapidirect_messages.php 74
12914 - if ($before_id) {
12915 - $message->whereAdd("id < $before_id");
12917 + if ($before_id) {
12918 + $message->whereAdd("id < $before_id");
12920 hunk ./actions/twitapidirect_messages.php 78
12922 - $message->whereAdd("id > $since_id");
12925 + $message->whereAdd("id > $since_id");
12927 hunk ./actions/twitapidirect_messages.php 82
12928 - $since = strtotime($this->arg('since'));
12929 + $since = strtotime($this->arg('since'));
12930 hunk ./actions/twitapidirect_messages.php 84
12932 - $d = date('Y-m-d H:i:s', $since);
12933 - $message->whereAdd("created > '$d'");
12936 + $d = date('Y-m-d H:i:s', $since);
12937 + $message->whereAdd("created > '$d'");
12939 hunk ./actions/twitapidirect_messages.php 89
12940 - $message->orderBy('created DESC, id DESC');
12941 - $message->limit((($page-1)*20), $count);
12942 - $message->find();
12943 + $message->orderBy('created DESC, id DESC');
12944 + $message->limit((($page-1)*20), $count);
12945 + $message->find();
12946 hunk ./actions/twitapidirect_messages.php 93
12947 - switch($apidata['content-type']) {
12949 - $this->show_xml_dmsgs($message);
12952 - $this->show_rss_dmsgs($message, $title, $link, $subtitle);
12955 - $this->show_atom_dmsgs($message, $title, $link, $subtitle);
12958 - $this->show_json_dmsgs($message);
12961 - common_user_error(_('API method not found!'), $code = 404);
12963 + switch($apidata['content-type']) {
12965 + $this->show_xml_dmsgs($message);
12968 + $this->show_rss_dmsgs($message, $title, $link, $subtitle);
12971 + $this->show_atom_dmsgs($message, $title, $link, $subtitle);
12974 + $this->show_json_dmsgs($message);
12977 + common_user_error(_('API method not found!'), $code = 404);
12979 hunk ./actions/twitapidirect_messages.php 110
12982 hunk ./actions/twitapidirect_messages.php 112
12983 - // had to change this from "new" to "create" to avoid PHP reserved word
12984 - function create($args, $apidata) {
12985 - parent::handle($args);
12986 + // had to change this from "new" to "create" to avoid PHP reserved word
12987 + function create($args, $apidata) {
12988 + parent::handle($args);
12989 hunk ./actions/twitapidirect_messages.php 116
12990 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
12991 - $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
12994 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
12995 + $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
12998 hunk ./actions/twitapidirect_messages.php 121
12999 - $user = $apidata['user'];
13000 - $source = $this->trimmed('source'); // Not supported by Twitter.
13001 + $user = $apidata['user'];
13002 + $source = $this->trimmed('source'); // Not supported by Twitter.
13003 hunk ./actions/twitapidirect_messages.php 125
13004 - if (!$source || in_array($source, $reserved_sources)) {
13007 + if (!$source || in_array($source, $reserved_sources)) {
13010 hunk ./actions/twitapidirect_messages.php 129
13011 - $content = $this->trimmed('text');
13012 + $content = $this->trimmed('text');
13013 hunk ./actions/twitapidirect_messages.php 131
13015 - $this->client_error(_('No message text!'), $code = 406, $apidata['content-type']);
13017 - $content_shortened = common_shorten_links($content);
13018 - if (mb_strlen($content_shortened) > 140) {
13019 - $this->client_error(_('That\'s too long. Max message size is 140 chars.'),
13020 - $code = 406, $apidata['content-type']);
13025 + $this->client_error(_('No message text!'), $code = 406, $apidata['content-type']);
13027 + $content_shortened = common_shorten_links($content);
13028 + if (mb_strlen($content_shortened) > 140) {
13029 + $this->client_error(_('That\'s too long. Max message size is 140 chars.'),
13030 + $code = 406, $apidata['content-type']);
13034 hunk ./actions/twitapidirect_messages.php 142
13035 - $other = $this->get_user($this->trimmed('user'));
13036 + $other = $this->get_user($this->trimmed('user'));
13037 hunk ./actions/twitapidirect_messages.php 144
13039 - $this->client_error(_('Recipient user not found.'), $code = 403, $apidata['content-type']);
13041 - } else if (!$user->mutuallySubscribed($other)) {
13042 - $this->client_error(_('Can\'t send direct messages to users who aren\'t your friend.'),
13043 - $code = 403, $apidata['content-type']);
13045 - } else if ($user->id == $other->id) {
13046 - // Sending msgs to yourself is allowed by Twitter
13047 - $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'),
13048 - $code = 403, $apidata['content-type']);
13052 + $this->client_error(_('Recipient user not found.'), $code = 403, $apidata['content-type']);
13054 + } else if (!$user->mutuallySubscribed($other)) {
13055 + $this->client_error(_('Can\'t send direct messages to users who aren\'t your friend.'),
13056 + $code = 403, $apidata['content-type']);
13058 + } else if ($user->id == $other->id) {
13059 + // Sending msgs to yourself is allowed by Twitter
13060 + $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'),
13061 + $code = 403, $apidata['content-type']);
13064 hunk ./actions/twitapidirect_messages.php 158
13065 - $message = Message::saveNew($user->id, $other->id,
13066 - html_entity_decode($content, ENT_NOQUOTES, 'UTF-8'), $source);
13067 + $message = Message::saveNew($user->id, $other->id,
13068 + html_entity_decode($content, ENT_NOQUOTES, 'UTF-8'), $source);
13069 hunk ./actions/twitapidirect_messages.php 161
13070 - if (is_string($message)) {
13071 - $this->server_error($message);
13074 + if (is_string($message)) {
13075 + $this->server_error($message);
13078 hunk ./actions/twitapidirect_messages.php 166
13079 - $this->notify($user, $other, $message);
13080 + $this->notify($user, $other, $message);
13081 hunk ./actions/twitapidirect_messages.php 168
13082 - if ($apidata['content-type'] == 'xml') {
13083 - $this->show_single_xml_dmsg($message);
13084 - } elseif ($apidata['content-type'] == 'json') {
13085 - $this->show_single_json_dmsg($message);
13087 + if ($apidata['content-type'] == 'xml') {
13088 + $this->show_single_xml_dmsg($message);
13089 + } elseif ($apidata['content-type'] == 'json') {
13090 + $this->show_single_json_dmsg($message);
13092 hunk ./actions/twitapidirect_messages.php 174
13095 hunk ./actions/twitapidirect_messages.php 176
13096 - function destroy($args, $apidata) {
13097 - parent::handle($args);
13098 - common_server_error(_('API method under construction.'), $code=501);
13100 + function destroy($args, $apidata) {
13101 + parent::handle($args);
13102 + common_server_error(_('API method under construction.'), $code=501);
13104 hunk ./actions/twitapidirect_messages.php 181
13105 - function show_xml_dmsgs($message) {
13106 + function show_xml_dmsgs($message) {
13107 hunk ./actions/twitapidirect_messages.php 183
13108 - $this->init_document('xml');
13109 - common_element_start('direct-messages', array('type' => 'array'));
13110 + $this->init_document('xml');
13111 + common_element_start('direct-messages', array('type' => 'array'));
13112 hunk ./actions/twitapidirect_messages.php 186
13113 - if (is_array($messages)) {
13114 - foreach ($message as $m) {
13115 - $twitter_dm = $this->twitter_dmsg_array($m);
13116 - $this->show_twitter_xml_dmsg($twitter_dm);
13119 - while ($message->fetch()) {
13120 - $twitter_dm = $this->twitter_dmsg_array($message);
13121 - $this->show_twitter_xml_dmsg($twitter_dm);
13124 + if (is_array($messages)) {
13125 + foreach ($message as $m) {
13126 + $twitter_dm = $this->twitter_dmsg_array($m);
13127 + $this->show_twitter_xml_dmsg($twitter_dm);
13130 + while ($message->fetch()) {
13131 + $twitter_dm = $this->twitter_dmsg_array($message);
13132 + $this->show_twitter_xml_dmsg($twitter_dm);
13135 hunk ./actions/twitapidirect_messages.php 198
13136 - common_element_end('direct-messages');
13137 - $this->end_document('xml');
13138 + common_element_end('direct-messages');
13139 + $this->end_document('xml');
13140 hunk ./actions/twitapidirect_messages.php 201
13143 hunk ./actions/twitapidirect_messages.php 203
13144 - function show_json_dmsgs($message) {
13145 + function show_json_dmsgs($message) {
13146 hunk ./actions/twitapidirect_messages.php 205
13147 - $this->init_document('json');
13148 + $this->init_document('json');
13149 hunk ./actions/twitapidirect_messages.php 207
13150 - $dmsgs = array();
13151 + $dmsgs = array();
13152 hunk ./actions/twitapidirect_messages.php 209
13153 - if (is_array($message)) {
13154 - foreach ($message as $m) {
13155 - $twitter_dm = $this->twitter_dmsg_array($m);
13156 - array_push($dmsgs, $twitter_dm);
13159 - while ($message->fetch()) {
13160 - $twitter_dm = $this->twitter_dmsg_array($message);
13161 - array_push($dmsgs, $twitter_dm);
13164 + if (is_array($message)) {
13165 + foreach ($message as $m) {
13166 + $twitter_dm = $this->twitter_dmsg_array($m);
13167 + array_push($dmsgs, $twitter_dm);
13170 + while ($message->fetch()) {
13171 + $twitter_dm = $this->twitter_dmsg_array($message);
13172 + array_push($dmsgs, $twitter_dm);
13175 hunk ./actions/twitapidirect_messages.php 221
13176 - $this->show_json_objects($dmsgs);
13177 - $this->end_document('json');
13178 + $this->show_json_objects($dmsgs);
13179 + $this->end_document('json');
13180 hunk ./actions/twitapidirect_messages.php 224
13183 hunk ./actions/twitapidirect_messages.php 226
13184 - function show_rss_dmsgs($message, $title, $link, $subtitle) {
13185 + function show_rss_dmsgs($message, $title, $link, $subtitle) {
13186 hunk ./actions/twitapidirect_messages.php 228
13187 - $this->init_document('rss');
13188 + $this->init_document('rss');
13189 hunk ./actions/twitapidirect_messages.php 230
13190 - common_element_start('channel');
13191 - common_element('title', NULL, $title);
13192 + common_element_start('channel');
13193 + common_element('title', NULL, $title);
13194 hunk ./actions/twitapidirect_messages.php 233
13195 - common_element('link', NULL, $link);
13196 - common_element('description', NULL, $subtitle);
13197 - common_element('language', NULL, 'en-us');
13198 - common_element('ttl', NULL, '40');
13199 + common_element('link', NULL, $link);
13200 + common_element('description', NULL, $subtitle);
13201 + common_element('language', NULL, 'en-us');
13202 + common_element('ttl', NULL, '40');
13203 hunk ./actions/twitapidirect_messages.php 238
13204 - if (is_array($message)) {
13205 - foreach ($message as $m) {
13206 - $entry = $this->twitter_rss_dmsg_array($m);
13207 - $this->show_twitter_rss_item($entry);
13210 - while ($message->fetch()) {
13211 - $entry = $this->twitter_rss_dmsg_array($message);
13212 - $this->show_twitter_rss_item($entry);
13215 + if (is_array($message)) {
13216 + foreach ($message as $m) {
13217 + $entry = $this->twitter_rss_dmsg_array($m);
13218 + $this->show_twitter_rss_item($entry);
13221 + while ($message->fetch()) {
13222 + $entry = $this->twitter_rss_dmsg_array($message);
13223 + $this->show_twitter_rss_item($entry);
13226 hunk ./actions/twitapidirect_messages.php 250
13227 - common_element_end('channel');
13228 - $this->end_twitter_rss();
13229 + common_element_end('channel');
13230 + $this->end_twitter_rss();
13231 hunk ./actions/twitapidirect_messages.php 253
13234 hunk ./actions/twitapidirect_messages.php 255
13235 - function show_atom_dmsgs($message, $title, $link, $subtitle) {
13236 + function show_atom_dmsgs($message, $title, $link, $subtitle) {
13237 hunk ./actions/twitapidirect_messages.php 257
13238 - $this->init_document('atom');
13239 + $this->init_document('atom');
13240 hunk ./actions/twitapidirect_messages.php 259
13241 - common_element('title', NULL, $title);
13242 - $siteserver = common_config('site', 'server');
13243 - common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
13244 - common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
13245 - common_element('updated', NULL, common_date_iso8601(strftime('%c')));
13246 - common_element('subtitle', NULL, $subtitle);
13247 + common_element('title', NULL, $title);
13248 + $siteserver = common_config('site', 'server');
13249 + common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
13250 + common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
13251 + common_element('updated', NULL, common_date_iso8601(strftime('%c')));
13252 + common_element('subtitle', NULL, $subtitle);
13253 hunk ./actions/twitapidirect_messages.php 266
13254 - if (is_array($message)) {
13255 - foreach ($message as $m) {
13256 - $entry = $this->twitter_rss_dmsg_array($m);
13257 - $this->show_twitter_atom_entry($entry);
13260 - while ($message->fetch()) {
13261 - $entry = $this->twitter_rss_dmsg_array($message);
13262 - $this->show_twitter_atom_entry($entry);
13265 + if (is_array($message)) {
13266 + foreach ($message as $m) {
13267 + $entry = $this->twitter_rss_dmsg_array($m);
13268 + $this->show_twitter_atom_entry($entry);
13271 + while ($message->fetch()) {
13272 + $entry = $this->twitter_rss_dmsg_array($message);
13273 + $this->show_twitter_atom_entry($entry);
13276 hunk ./actions/twitapidirect_messages.php 278
13277 - $this->end_document('atom');
13279 + $this->end_document('atom');
13281 hunk ./actions/twitapidirect_messages.php 281
13282 - // swiped from MessageAction. Should it be place in util.php?
13283 - function notify($from, $to, $message) {
13284 - mail_notify_message($message, $from, $to);
13285 - # XXX: Jabber, SMS notifications... probably queued
13287 + // swiped from MessageAction. Should it be place in util.php?
13288 + function notify($from, $to, $message) {
13289 + mail_notify_message($message, $from, $to);
13290 + # XXX: Jabber, SMS notifications... probably queued
13292 hunk ./actions/twitapifavorites.php 26
13293 - function favorites($args, $apidata) {
13294 - parent::handle($args);
13295 + function favorites($args, $apidata) {
13296 + parent::handle($args);
13297 hunk ./actions/twitapifavorites.php 29
13298 - $this->auth_user = $apidata['user'];
13299 - $user = $this->get_user($apidata['api_arg'], $apidata);
13300 + $this->auth_user = $apidata['user'];
13301 + $user = $this->get_user($apidata['api_arg'], $apidata);
13302 hunk ./actions/twitapifavorites.php 32
13304 - $this->client_error('Not Found', 404, $apidata['content-type']);
13308 + $this->client_error('Not Found', 404, $apidata['content-type']);
13311 hunk ./actions/twitapifavorites.php 37
13312 - $profile = $user->getProfile();
13313 + $profile = $user->getProfile();
13314 hunk ./actions/twitapifavorites.php 39
13316 - common_server_error(_('User has no profile.'));
13320 + common_server_error(_('User has no profile.'));
13323 hunk ./actions/twitapifavorites.php 44
13324 - $page = $this->arg('page');
13325 + $page = $this->arg('page');
13326 hunk ./actions/twitapifavorites.php 46
13333 hunk ./actions/twitapifavorites.php 50
13340 hunk ./actions/twitapifavorites.php 54
13341 - $notice = $user->favoriteNotices((($page-1)*20), $count);
13342 + $notice = $user->favoriteNotices((($page-1)*20), $count);
13343 hunk ./actions/twitapifavorites.php 56
13345 - common_server_error(_('Could not retrieve favorite notices.'));
13349 + common_server_error(_('Could not retrieve favorite notices.'));
13352 hunk ./actions/twitapifavorites.php 61
13353 - $sitename = common_config('site', 'name');
13354 - $siteserver = common_config('site', 'server');
13355 + $sitename = common_config('site', 'name');
13356 + $siteserver = common_config('site', 'server');
13357 hunk ./actions/twitapifavorites.php 64
13358 - $title = sprintf(_('%s / Favorites from %s'), $sitename, $user->nickname);
13359 - $id = "tag:$siteserver:favorites:".$user->id;
13360 - $link = common_local_url('favorites', array('nickname' => $user->nickname));
13361 - $subtitle = sprintf(_('%s updates favorited by %s / %s.'), $sitename, $profile->getBestName(), $user->nickname);
13362 + $title = sprintf(_('%s / Favorites from %s'), $sitename, $user->nickname);
13363 + $id = "tag:$siteserver:favorites:".$user->id;
13364 + $link = common_local_url('favorites', array('nickname' => $user->nickname));
13365 + $subtitle = sprintf(_('%s updates favorited by %s / %s.'), $sitename, $profile->getBestName(), $user->nickname);
13366 hunk ./actions/twitapifavorites.php 69
13367 - switch($apidata['content-type']) {
13369 - $this->show_xml_timeline($notice);
13372 - $this->show_rss_timeline($notice, $title, $link, $subtitle);
13375 - $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
13378 - $this->show_json_timeline($notice);
13381 - common_user_error(_('API method not found!'), $code = 404);
13383 + switch($apidata['content-type']) {
13385 + $this->show_xml_timeline($notice);
13388 + $this->show_rss_timeline($notice, $title, $link, $subtitle);
13391 + $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
13394 + $this->show_json_timeline($notice);
13397 + common_user_error(_('API method not found!'), $code = 404);
13399 hunk ./actions/twitapifavorites.php 86
13402 hunk ./actions/twitapifavorites.php 88
13403 - function create($args, $apidata) {
13404 - parent::handle($args);
13405 + function create($args, $apidata) {
13406 + parent::handle($args);
13407 hunk ./actions/twitapifavorites.php 91
13408 - // Check for RESTfulness
13409 - if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
13410 - // XXX: Twitter just prints the err msg, no XML / JSON.
13411 - $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
13414 + // Check for RESTfulness
13415 + if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
13416 + // XXX: Twitter just prints the err msg, no XML / JSON.
13417 + $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
13420 hunk ./actions/twitapifavorites.php 98
13421 - if (!in_array($apidata['content-type'], array('xml', 'json'))) {
13422 - common_user_error(_('API method not found!'), $code = 404);
13425 + if (!in_array($apidata['content-type'], array('xml', 'json'))) {
13426 + common_user_error(_('API method not found!'), $code = 404);
13429 hunk ./actions/twitapifavorites.php 103
13430 - $this->auth_user = $apidata['user'];
13431 - $user = $this->auth_user;
13432 - $notice_id = $apidata['api_arg'];
13433 - $notice = Notice::staticGet($notice_id);
13434 + $this->auth_user = $apidata['user'];
13435 + $user = $this->auth_user;
13436 + $notice_id = $apidata['api_arg'];
13437 + $notice = Notice::staticGet($notice_id);
13438 hunk ./actions/twitapifavorites.php 108
13440 - $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
13444 + $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
13447 hunk ./actions/twitapifavorites.php 113
13448 - // XXX: Twitter lets you fave things repeatedly via api.
13449 - if ($user->hasFave($notice)) {
13450 - $this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']);
13453 + // XXX: Twitter lets you fave things repeatedly via api.
13454 + if ($user->hasFave($notice)) {
13455 + $this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']);
13458 hunk ./actions/twitapifavorites.php 119
13459 - $fave = Fave::addNew($user, $notice);
13460 + $fave = Fave::addNew($user, $notice);
13461 hunk ./actions/twitapifavorites.php 121
13463 - common_server_error(_('Could not create favorite.'));
13467 + common_server_error(_('Could not create favorite.'));
13470 hunk ./actions/twitapifavorites.php 126
13471 - $this->notify($fave, $notice, $user);
13472 - $user->blowFavesCache();
13473 + $this->notify($fave, $notice, $user);
13474 + $user->blowFavesCache();
13475 hunk ./actions/twitapifavorites.php 129
13476 - if ($apidata['content-type'] == 'xml') {
13477 - $this->show_single_xml_status($notice);
13478 - } elseif ($apidata['content-type'] == 'json') {
13479 - $this->show_single_json_status($notice);
13481 + if ($apidata['content-type'] == 'xml') {
13482 + $this->show_single_xml_status($notice);
13483 + } elseif ($apidata['content-type'] == 'json') {
13484 + $this->show_single_json_status($notice);
13486 hunk ./actions/twitapifavorites.php 135
13489 hunk ./actions/twitapifavorites.php 137
13490 - function destroy($args, $apidata) {
13491 - parent::handle($args);
13492 - common_server_error(_('API method under construction.'), $code=501);
13494 + function destroy($args, $apidata) {
13495 + parent::handle($args);
13496 + common_server_error(_('API method under construction.'), $code=501);
13498 hunk ./actions/twitapifavorites.php 142
13499 - // XXX: these two funcs swiped from faves. Maybe put in util.php, or some common base class?
13500 + // XXX: these two funcs swiped from faves. Maybe put in util.php, or some common base class?
13501 hunk ./actions/twitapifavorites.php 144
13502 - function notify($fave, $notice, $user) {
13503 - $other = User::staticGet('id', $notice->profile_id);
13504 - if ($other && $other->id != $user->id) {
13505 - if ($other->email && $other->emailnotifyfav) {
13506 - $this->notify_mail($other, $user, $notice);
13508 - # XXX: notify by IM
13509 - # XXX: notify by SMS
13512 + function notify($fave, $notice, $user) {
13513 + $other = User::staticGet('id', $notice->profile_id);
13514 + if ($other && $other->id != $user->id) {
13515 + if ($other->email && $other->emailnotifyfav) {
13516 + $this->notify_mail($other, $user, $notice);
13518 + # XXX: notify by IM
13519 + # XXX: notify by SMS
13522 hunk ./actions/twitapifavorites.php 155
13523 - function notify_mail($other, $user, $notice) {
13524 - $profile = $user->getProfile();
13525 - $bestname = $profile->getBestName();
13526 - $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
13527 - $body = sprintf(_("%1\$s just added your notice from %2\$s as one of their favorites.\n\n" .
13528 - "In case you forgot, you can see the text of your notice here:\n\n" .
13530 - "You can see the list of %1\$s's favorites here:\n\n" .
13532 - "Faithfully yours,\n" .
13535 - common_exact_date($notice->created),
13536 - common_local_url('shownotice', array('notice' => $notice->id)),
13537 - common_local_url('showfavorites', array('nickname' => $user->nickname)),
13538 - common_config('site', 'name'));
13539 + function notify_mail($other, $user, $notice) {
13540 + $profile = $user->getProfile();
13541 + $bestname = $profile->getBestName();
13542 + $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
13543 + $body = sprintf(_("%1\$s just added your notice from %2\$s as one of their favorites.\n\n" .
13544 + "In case you forgot, you can see the text of your notice here:\n\n" .
13546 + "You can see the list of %1\$s's favorites here:\n\n" .
13548 + "Faithfully yours,\n" .
13551 + common_exact_date($notice->created),
13552 + common_local_url('shownotice', array('notice' => $notice->id)),
13553 + common_local_url('showfavorites', array('nickname' => $user->nickname)),
13554 + common_config('site', 'name'));
13555 hunk ./actions/twitapifavorites.php 172
13556 - mail_to_user($other, $subject, $body);
13558 + mail_to_user($other, $subject, $body);
13560 hunk ./actions/twitapifriendships.php 26
13561 - function create($args, $apidata) {
13562 - parent::handle($args);
13563 + function create($args, $apidata) {
13564 + parent::handle($args);
13565 hunk ./actions/twitapifriendships.php 29
13566 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
13567 - $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
13570 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
13571 + $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
13574 hunk ./actions/twitapifriendships.php 34
13575 - $id = $apidata['api_arg'];
13576 + $id = $apidata['api_arg'];
13577 hunk ./actions/twitapifriendships.php 36
13578 - $other = $this->get_user($id);
13579 + $other = $this->get_user($id);
13580 hunk ./actions/twitapifriendships.php 38
13582 - $this->client_error(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
13586 + $this->client_error(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
13589 hunk ./actions/twitapifriendships.php 43
13590 - $user = $apidata['user'];
13591 + $user = $apidata['user'];
13592 hunk ./actions/twitapifriendships.php 45
13593 - if ($user->isSubscribed($other)) {
13594 - $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
13595 - $this->client_error($errmsg, 403, $apidata['content-type']);
13598 + if ($user->isSubscribed($other)) {
13599 + $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
13600 + $this->client_error($errmsg, 403, $apidata['content-type']);
13603 hunk ./actions/twitapifriendships.php 51
13604 - $sub = new Subscription();
13605 + $sub = new Subscription();
13606 hunk ./actions/twitapifriendships.php 53
13607 - $sub->query('BEGIN');
13608 + $sub->query('BEGIN');
13609 hunk ./actions/twitapifriendships.php 55
13610 - $sub->subscriber = $user->id;
13611 - $sub->subscribed = $other->id;
13612 - $sub->created = DB_DataObject_Cast::dateTime(); # current time
13613 + $sub->subscriber = $user->id;
13614 + $sub->subscribed = $other->id;
13615 + $sub->created = DB_DataObject_Cast::dateTime(); # current time
13616 hunk ./actions/twitapifriendships.php 59
13617 - $result = $sub->insert();
13618 + $result = $sub->insert();
13619 hunk ./actions/twitapifriendships.php 61
13621 - $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
13622 - $this->client_error($errmsg, 400, $apidata['content-type']);
13626 + $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
13627 + $this->client_error($errmsg, 400, $apidata['content-type']);
13630 hunk ./actions/twitapifriendships.php 67
13631 - $sub->query('COMMIT');
13632 + $sub->query('COMMIT');
13633 hunk ./actions/twitapifriendships.php 69
13634 - mail_subscribe_notify($other, $user);
13635 + mail_subscribe_notify($other, $user);
13636 hunk ./actions/twitapifriendships.php 71
13637 - $type = $apidata['content-type'];
13638 - $this->init_document($type);
13639 - $this->show_profile($other, $type);
13640 - $this->end_document($type);
13641 + $type = $apidata['content-type'];
13642 + $this->init_document($type);
13643 + $this->show_profile($other, $type);
13644 + $this->end_document($type);
13645 hunk ./actions/twitapifriendships.php 76
13648 hunk ./actions/twitapifriendships.php 78
13649 - function destroy($args, $apidata) {
13650 - parent::handle($args);
13651 + function destroy($args, $apidata) {
13652 + parent::handle($args);
13653 hunk ./actions/twitapifriendships.php 81
13654 - if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
13655 - $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
13658 + if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
13659 + $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
13662 hunk ./actions/twitapifriendships.php 86
13663 - $id = $apidata['api_arg'];
13664 + $id = $apidata['api_arg'];
13665 hunk ./actions/twitapifriendships.php 88
13666 - # We can't subscribe to a remote person, but we can unsub
13667 + # We can't subscribe to a remote person, but we can unsub
13668 hunk ./actions/twitapifriendships.php 90
13669 - $other = $this->get_profile($id);
13670 - $user = $apidata['user'];
13671 + $other = $this->get_profile($id);
13672 + $user = $apidata['user'];
13673 hunk ./actions/twitapifriendships.php 93
13674 - $sub = new Subscription();
13675 - $sub->subscriber = $user->id;
13676 - $sub->subscribed = $other->id;
13677 + $sub = new Subscription();
13678 + $sub->subscriber = $user->id;
13679 + $sub->subscribed = $other->id;
13680 hunk ./actions/twitapifriendships.php 97
13681 - if ($sub->find(TRUE)) {
13682 - $sub->query('BEGIN');
13684 - $sub->query('COMMIT');
13686 - $this->client_error(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
13689 + if ($sub->find(TRUE)) {
13690 + $sub->query('BEGIN');
13692 + $sub->query('COMMIT');
13694 + $this->client_error(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
13697 hunk ./actions/twitapifriendships.php 106
13698 - $type = $apidata['content-type'];
13699 - $this->init_document($type);
13700 - $this->show_profile($other, $type);
13701 - $this->end_document($type);
13702 + $type = $apidata['content-type'];
13703 + $this->init_document($type);
13704 + $this->show_profile($other, $type);
13705 + $this->end_document($type);
13706 hunk ./actions/twitapifriendships.php 111
13709 hunk ./actions/twitapifriendships.php 113
13710 - function exists($args, $apidata) {
13711 - parent::handle($args);
13712 + function exists($args, $apidata) {
13713 + parent::handle($args);
13714 hunk ./actions/twitapifriendships.php 116
13715 - if (!in_array($apidata['content-type'], array('xml', 'json'))) {
13716 - common_user_error(_('API method not found!'), $code = 404);
13719 + if (!in_array($apidata['content-type'], array('xml', 'json'))) {
13720 + common_user_error(_('API method not found!'), $code = 404);
13723 hunk ./actions/twitapifriendships.php 121
13724 - $user_a_id = $this->trimmed('user_a');
13725 - $user_b_id = $this->trimmed('user_b');
13726 + $user_a_id = $this->trimmed('user_a');
13727 + $user_b_id = $this->trimmed('user_b');
13728 hunk ./actions/twitapifriendships.php 124
13729 - $user_a = $this->get_user($user_a_id);
13730 - $user_b = $this->get_user($user_b_id);
13731 + $user_a = $this->get_user($user_a_id);
13732 + $user_b = $this->get_user($user_b_id);
13733 hunk ./actions/twitapifriendships.php 127
13734 - if (!$user_a || !$user_b) {
13735 - $this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
13738 + if (!$user_a || !$user_b) {
13739 + $this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
13742 hunk ./actions/twitapifriendships.php 132
13743 - if ($user_a->isSubscribed($user_b)) {
13744 - $result = 'true';
13746 - $result = 'false';
13748 + if ($user_a->isSubscribed($user_b)) {
13749 + $result = 'true';
13751 + $result = 'false';
13753 hunk ./actions/twitapifriendships.php 138
13754 - switch ($apidata['content-type']) {
13756 - $this->init_document('xml');
13757 - common_element('friends', NULL, $result);
13758 - $this->end_document('xml');
13761 - $this->init_document('json');
13762 - print json_encode($result);
13763 - $this->end_document('json');
13768 + switch ($apidata['content-type']) {
13770 + $this->init_document('xml');
13771 + common_element('friends', NULL, $result);
13772 + $this->end_document('xml');
13775 + $this->init_document('json');
13776 + print json_encode($result);
13777 + $this->end_document('json');
13782 hunk ./actions/twitapifriendships.php 153
13785 hunk ./actions/twitapihelp.php 26
13786 - /* Returns the string "ok" in the requested format with a 200 OK HTTP status code.
13787 - * URL:http://identi.ca/api/help/test.format
13788 - * Formats: xml, json
13790 - function test($args, $apidata) {
13791 - parent::handle($args);
13792 + /* Returns the string "ok" in the requested format with a 200 OK HTTP status code.
13793 + * URL:http://identi.ca/api/help/test.format
13794 + * Formats: xml, json
13796 + function test($args, $apidata) {
13797 + parent::handle($args);
13798 hunk ./actions/twitapihelp.php 33
13799 - if ($apidata['content-type'] == 'xml') {
13800 - $this->init_document('xml');
13801 - common_element('ok', NULL, 'true');
13802 - $this->end_document('xml');
13803 - } elseif ($apidata['content-type'] == 'json') {
13804 - $this->init_document('json');
13806 - $this->end_document('json');
13808 - common_user_error(_('API method not found!'), $code=404);
13810 + if ($apidata['content-type'] == 'xml') {
13811 + $this->init_document('xml');
13812 + common_element('ok', NULL, 'true');
13813 + $this->end_document('xml');
13814 + } elseif ($apidata['content-type'] == 'json') {
13815 + $this->init_document('json');
13817 + $this->end_document('json');
13819 + common_user_error(_('API method not found!'), $code=404);
13821 hunk ./actions/twitapihelp.php 45
13824 hunk ./actions/twitapihelp.php 47
13825 - function downtime_schedule($args, $apidata) {
13826 - parent::handle($args);
13827 - common_server_error(_('API method under construction.'), $code=501);
13829 + function downtime_schedule($args, $apidata) {
13830 + parent::handle($args);
13831 + common_server_error(_('API method under construction.'), $code=501);
13833 hunk ./actions/twitapinotifications.php 27
13834 - function follow($args, $apidata) {
13835 - parent::handle($args);
13836 - common_server_error(_('API method under construction.'), $code=501);
13838 + function follow($args, $apidata) {
13839 + parent::handle($args);
13840 + common_server_error(_('API method under construction.'), $code=501);
13842 hunk ./actions/twitapinotifications.php 32
13843 - function leave($args, $apidata) {
13844 - parent::handle($args);
13845 - common_server_error(_('API method under construction.'), $code=501);
13847 + function leave($args, $apidata) {
13848 + parent::handle($args);
13849 + common_server_error(_('API method under construction.'), $code=501);
13851 hunk ./actions/twitapistatuses.php 26
13852 - function public_timeline($args, $apidata) {
13853 - parent::handle($args);
13854 + function public_timeline($args, $apidata) {
13855 + parent::handle($args);
13856 hunk ./actions/twitapistatuses.php 29
13857 - $sitename = common_config('site', 'name');
13858 - $siteserver = common_config('site', 'server');
13859 - $title = sprintf(_("%s public timeline"), $sitename);
13860 - $id = "tag:$siteserver:Statuses";
13861 - $link = common_root_url();
13862 - $subtitle = sprintf(_("%s updates from everyone!"), $sitename);
13863 + $sitename = common_config('site', 'name');
13864 + $siteserver = common_config('site', 'server');
13865 + $title = sprintf(_("%s public timeline"), $sitename);
13866 + $id = "tag:$siteserver:Statuses";
13867 + $link = common_root_url();
13868 + $subtitle = sprintf(_("%s updates from everyone!"), $sitename);
13869 hunk ./actions/twitapistatuses.php 36
13870 - // Number of public statuses to return by default -- Twitter sends 20
13871 - $MAX_PUBSTATUSES = 20;
13872 + // Number of public statuses to return by default -- Twitter sends 20
13873 + $MAX_PUBSTATUSES = 20;
13874 hunk ./actions/twitapistatuses.php 39
13875 - // FIXME: To really live up to the spec we need to build a list
13876 - // of notices by users who have custom avatars, so fix this SQL -- Zach
13877 + // FIXME: To really live up to the spec we need to build a list
13878 + // of notices by users who have custom avatars, so fix this SQL -- Zach
13879 hunk ./actions/twitapistatuses.php 42
13880 - $page = $this->arg('page');
13881 - $since_id = $this->arg('since_id');
13882 - $before_id = $this->arg('before_id');
13883 + $page = $this->arg('page');
13884 + $since_id = $this->arg('since_id');
13885 + $before_id = $this->arg('before_id');
13886 hunk ./actions/twitapistatuses.php 46
13887 - // NOTE: page, since_id, and before_id are extensions to Twitter API -- TB
13891 - if (!$since_id) {
13894 - if (!$before_id) {
13897 + // NOTE: page, since_id, and before_id are extensions to Twitter API -- TB
13901 + if (!$since_id) {
13904 + if (!$before_id) {
13907 hunk ./actions/twitapistatuses.php 57
13908 - $since = strtotime($this->arg('since'));
13909 + $since = strtotime($this->arg('since'));
13910 hunk ./actions/twitapistatuses.php 59
13911 - $notice = Notice::publicStream((($page-1)*$MAX_PUBSTATUSES), $MAX_PUBSTATUSES, $since_id, $before_id, $since);
13912 + $notice = Notice::publicStream((($page-1)*$MAX_PUBSTATUSES), $MAX_PUBSTATUSES, $since_id, $before_id, $since);
13913 hunk ./actions/twitapistatuses.php 61
13916 hunk ./actions/twitapistatuses.php 63
13917 - switch($apidata['content-type']) {
13919 - $this->show_xml_timeline($notice);
13922 - $this->show_rss_timeline($notice, $title, $link, $subtitle);
13925 - $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
13928 - $this->show_json_timeline($notice);
13931 - common_user_error(_('API method not found!'), $code = 404);
13934 + switch($apidata['content-type']) {
13936 + $this->show_xml_timeline($notice);
13939 + $this->show_rss_timeline($notice, $title, $link, $subtitle);
13942 + $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
13945 + $this->show_json_timeline($notice);
13948 + common_user_error(_('API method not found!'), $code = 404);
13951 hunk ./actions/twitapistatuses.php 81
13953 - common_server_error(_('Couldn\'t find any statuses.'), $code = 503);
13956 + common_server_error(_('Couldn\'t find any statuses.'), $code = 503);
13958 hunk ./actions/twitapistatuses.php 85
13961 hunk ./actions/twitapistatuses.php 87
13962 - function friends_timeline($args, $apidata) {
13963 - parent::handle($args);
13964 + function friends_timeline($args, $apidata) {
13965 + parent::handle($args);
13966 hunk ./actions/twitapistatuses.php 90
13967 - $since = $this->arg('since');
13968 - $since_id = $this->arg('since_id');
13969 - $count = $this->arg('count');
13970 - $page = $this->arg('page');
13971 - $before_id = $this->arg('before_id');
13972 + $since = $this->arg('since');
13973 + $since_id = $this->arg('since_id');
13974 + $count = $this->arg('count');
13975 + $page = $this->arg('page');
13976 + $before_id = $this->arg('before_id');
13977 hunk ./actions/twitapistatuses.php 96
13984 hunk ./actions/twitapistatuses.php 100
13991 hunk ./actions/twitapistatuses.php 104
13992 - if (!$since_id) {
13995 + if (!$since_id) {
13998 hunk ./actions/twitapistatuses.php 108
13999 - // NOTE: before_id is an extension to Twitter API -- TB
14000 - if (!$before_id) {
14003 + // NOTE: before_id is an extension to Twitter API -- TB
14004 + if (!$before_id) {
14007 hunk ./actions/twitapistatuses.php 113
14008 - $since = strtotime($this->arg('since'));
14009 + $since = strtotime($this->arg('since'));
14010 hunk ./actions/twitapistatuses.php 115
14011 - $user = $this->get_user(NULL, $apidata);
14012 - $this->auth_user = $user;
14013 + $user = $this->get_user(NULL, $apidata);
14014 + $this->auth_user = $user;
14015 hunk ./actions/twitapistatuses.php 118
14016 - $profile = $user->getProfile();
14017 + $profile = $user->getProfile();
14018 hunk ./actions/twitapistatuses.php 120
14019 - $sitename = common_config('site', 'name');
14020 - $siteserver = common_config('site', 'server');
14021 + $sitename = common_config('site', 'name');
14022 + $siteserver = common_config('site', 'server');
14023 hunk ./actions/twitapistatuses.php 123
14024 - $title = sprintf(_("%s and friends"), $user->nickname);
14025 - $id = "tag:$siteserver:friends:" . $user->id;
14026 - $link = common_local_url('all', array('nickname' => $user->nickname));
14027 - $subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $user->nickname, $sitename);
14028 + $title = sprintf(_("%s and friends"), $user->nickname);
14029 + $id = "tag:$siteserver:friends:" . $user->id;
14030 + $link = common_local_url('all', array('nickname' => $user->nickname));
14031 + $subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $user->nickname, $sitename);
14032 hunk ./actions/twitapistatuses.php 128
14033 - $notice = $user->noticesWithFriends(($page-1)*20, $count, $since_id, $before_id, $since);
14034 + $notice = $user->noticesWithFriends(($page-1)*20, $count, $since_id, $before_id, $since);
14035 hunk ./actions/twitapistatuses.php 130
14036 - switch($apidata['content-type']) {
14038 - $this->show_xml_timeline($notice);
14041 - $this->show_rss_timeline($notice, $title, $link, $subtitle);
14044 - $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
14047 - $this->show_json_timeline($notice);
14050 - common_user_error(_('API method not found!'), $code = 404);
14052 + switch($apidata['content-type']) {
14054 + $this->show_xml_timeline($notice);
14057 + $this->show_rss_timeline($notice, $title, $link, $subtitle);
14060 + $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
14063 + $this->show_json_timeline($notice);
14066 + common_user_error(_('API method not found!'), $code = 404);
14068 hunk ./actions/twitapistatuses.php 147
14071 hunk ./actions/twitapistatuses.php 149
14072 - function user_timeline($args, $apidata) {
14073 - parent::handle($args);
14074 + function user_timeline($args, $apidata) {
14075 + parent::handle($args);
14076 hunk ./actions/twitapistatuses.php 152
14077 - $this->auth_user = $apidata['user'];
14078 - $user = $this->get_user($apidata['api_arg'], $apidata);
14079 + $this->auth_user = $apidata['user'];
14080 + $user = $this->get_user($apidata['api_arg'], $apidata);
14081 hunk ./actions/twitapistatuses.php 155
14083 - $this->client_error('Not Found', 404, $apidata['content-type']);
14087 + $this->client_error('Not Found', 404, $apidata['content-type']);
14090 hunk ./actions/twitapistatuses.php 160
14091 - $profile = $user->getProfile();
14092 + $profile = $user->getProfile();
14093 hunk ./actions/twitapistatuses.php 162
14095 - common_server_error(_('User has no profile.'));
14099 + common_server_error(_('User has no profile.'));
14102 hunk ./actions/twitapistatuses.php 167
14103 - $count = $this->arg('count');
14104 - $since = $this->arg('since');
14105 - $since_id = $this->arg('since_id');
14106 - $page = $this->arg('page');
14107 - $before_id = $this->arg('before_id');
14108 + $count = $this->arg('count');
14109 + $since = $this->arg('since');
14110 + $since_id = $this->arg('since_id');
14111 + $page = $this->arg('page');
14112 + $before_id = $this->arg('before_id');
14113 hunk ./actions/twitapistatuses.php 173
14120 hunk ./actions/twitapistatuses.php 177
14127 hunk ./actions/twitapistatuses.php 181
14128 - if (!$since_id) {
14131 + if (!$since_id) {
14134 hunk ./actions/twitapistatuses.php 185
14135 - // NOTE: before_id is an extensions to Twitter API -- TB
14136 - if (!$before_id) {
14139 + // NOTE: before_id is an extensions to Twitter API -- TB
14140 + if (!$before_id) {
14143 hunk ./actions/twitapistatuses.php 190
14144 - $since = strtotime($this->arg('since'));
14145 + $since = strtotime($this->arg('since'));
14146 hunk ./actions/twitapistatuses.php 192
14147 - $sitename = common_config('site', 'name');
14148 - $siteserver = common_config('site', 'server');
14149 + $sitename = common_config('site', 'name');
14150 + $siteserver = common_config('site', 'server');
14151 hunk ./actions/twitapistatuses.php 195
14152 - $title = sprintf(_("%s timeline"), $user->nickname);
14153 - $id = "tag:$siteserver:user:".$user->id;
14154 - $link = common_local_url('showstream', array('nickname' => $user->nickname));
14155 - $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
14156 + $title = sprintf(_("%s timeline"), $user->nickname);
14157 + $id = "tag:$siteserver:user:".$user->id;
14158 + $link = common_local_url('showstream', array('nickname' => $user->nickname));
14159 + $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
14160 hunk ./actions/twitapistatuses.php 200
14161 - # FriendFeed's SUP protocol
14162 - # Also added RSS and Atom feeds
14163 + # FriendFeed's SUP protocol
14164 + # Also added RSS and Atom feeds
14165 hunk ./actions/twitapistatuses.php 203
14166 - $suplink = common_local_url('sup', NULL, $user->id);
14167 - header('X-SUP-ID: '.$suplink);
14168 + $suplink = common_local_url('sup', NULL, $user->id);
14169 + header('X-SUP-ID: '.$suplink);
14170 hunk ./actions/twitapistatuses.php 206
14173 hunk ./actions/twitapistatuses.php 208
14174 - $notice = $user->getNotices((($page-1)*20), $count, $since_id, $before_id, $since);
14175 + $notice = $user->getNotices((($page-1)*20), $count, $since_id, $before_id, $since);
14176 hunk ./actions/twitapistatuses.php 210
14177 - switch($apidata['content-type']) {
14179 - $this->show_xml_timeline($notice);
14182 - $this->show_rss_timeline($notice, $title, $link, $subtitle, $suplink);
14185 - $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink);
14188 - $this->show_json_timeline($notice);
14191 - common_user_error(_('API method not found!'), $code = 404);
14193 + switch($apidata['content-type']) {
14195 + $this->show_xml_timeline($notice);
14198 + $this->show_rss_timeline($notice, $title, $link, $subtitle, $suplink);
14201 + $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink);
14204 + $this->show_json_timeline($notice);
14207 + common_user_error(_('API method not found!'), $code = 404);
14209 hunk ./actions/twitapistatuses.php 227
14212 hunk ./actions/twitapistatuses.php 229
14213 - function update($args, $apidata) {
14214 + function update($args, $apidata) {
14215 hunk ./actions/twitapistatuses.php 231
14216 - parent::handle($args);
14217 + parent::handle($args);
14218 hunk ./actions/twitapistatuses.php 233
14219 - if (!in_array($apidata['content-type'], array('xml', 'json'))) {
14220 - common_user_error(_('API method not found!'), $code = 404);
14223 + if (!in_array($apidata['content-type'], array('xml', 'json'))) {
14224 + common_user_error(_('API method not found!'), $code = 404);
14227 hunk ./actions/twitapistatuses.php 238
14228 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
14229 - $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
14232 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
14233 + $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
14236 hunk ./actions/twitapistatuses.php 243
14237 - $this->auth_user = $apidata['user'];
14238 - $user = $this->auth_user;
14239 - $status = $this->trimmed('status');
14240 - $source = $this->trimmed('source');
14241 - $in_reply_to_status_id = intval($this->trimmed('in_reply_to_status_id'));
14242 + $this->auth_user = $apidata['user'];
14243 + $user = $this->auth_user;
14244 + $status = $this->trimmed('status');
14245 + $source = $this->trimmed('source');
14246 + $in_reply_to_status_id = intval($this->trimmed('in_reply_to_status_id'));
14247 hunk ./actions/twitapistatuses.php 249
14248 - if (!$source || in_array($source, $reserved_sources)) {
14251 + if (!$source || in_array($source, $reserved_sources)) {
14254 hunk ./actions/twitapistatuses.php 253
14257 hunk ./actions/twitapistatuses.php 255
14258 - // XXX: Note: In this case, Twitter simply returns '200 OK'
14259 - // No error is given, but the status is not posted to the
14260 - // user's timeline. Seems bad. Shouldn't we throw an
14261 - // errror? -- Zach
14263 + // XXX: Note: In this case, Twitter simply returns '200 OK'
14264 + // No error is given, but the status is not posted to the
14265 + // user's timeline. Seems bad. Shouldn't we throw an
14266 + // errror? -- Zach
14268 hunk ./actions/twitapistatuses.php 261
14271 hunk ./actions/twitapistatuses.php 263
14272 - $status_shortened = common_shorten_links($status);
14273 + $status_shortened = common_shorten_links($status);
14274 hunk ./actions/twitapistatuses.php 265
14275 - if (mb_strlen($status_shortened) > 140) {
14276 + if (mb_strlen($status_shortened) > 140) {
14277 hunk ./actions/twitapistatuses.php 267
14278 - // XXX: Twitter truncates anything over 140, flags the status
14279 - // as "truncated." Sending this error may screw up some clients
14280 - // that assume Twitter will truncate for them. Should we just
14281 - // truncate too? -- Zach
14282 - $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
14284 + // XXX: Twitter truncates anything over 140, flags the status
14285 + // as "truncated." Sending this error may screw up some clients
14286 + // that assume Twitter will truncate for them. Should we just
14287 + // truncate too? -- Zach
14288 + $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
14290 hunk ./actions/twitapistatuses.php 274
14295 hunk ./actions/twitapistatuses.php 277
14296 - // Check for commands
14297 - $inter = new CommandInterpreter();
14298 - $cmd = $inter->handle_command($user, $status_shortened);
14299 + // Check for commands
14300 + $inter = new CommandInterpreter();
14301 + $cmd = $inter->handle_command($user, $status_shortened);
14302 hunk ./actions/twitapistatuses.php 281
14305 hunk ./actions/twitapistatuses.php 283
14306 - if ($this->supported($cmd)) {
14307 - $cmd->execute(new Channel());
14309 + if ($this->supported($cmd)) {
14310 + $cmd->execute(new Channel());
14312 hunk ./actions/twitapistatuses.php 287
14313 - // cmd not supported? Twitter just returns your latest status.
14314 - // And, it returns your last status whether the cmd was successful
14316 - $n = $user->getCurrentNotice();
14317 - $apidata['api_arg'] = $n->id;
14319 + // cmd not supported? Twitter just returns your latest status.
14320 + // And, it returns your last status whether the cmd was successful
14322 + $n = $user->getCurrentNotice();
14323 + $apidata['api_arg'] = $n->id;
14325 hunk ./actions/twitapistatuses.php 294
14326 - $reply_to = NULL;
14327 + $reply_to = NULL;
14328 hunk ./actions/twitapistatuses.php 296
14329 - if ($in_reply_to_status_id) {
14330 + if ($in_reply_to_status_id) {
14331 hunk ./actions/twitapistatuses.php 298
14332 - // check whether notice actually exists
14333 - $reply = Notice::staticGet($in_reply_to_status_id);
14334 + // check whether notice actually exists
14335 + $reply = Notice::staticGet($in_reply_to_status_id);
14336 hunk ./actions/twitapistatuses.php 301
14338 - $reply_to = $in_reply_to_status_id;
14340 - $this->client_error(_('Not found'), $code = 404, $apidata['content-type']);
14345 + $reply_to = $in_reply_to_status_id;
14347 + $this->client_error(_('Not found'), $code = 404, $apidata['content-type']);
14351 hunk ./actions/twitapistatuses.php 309
14352 - $notice = Notice::saveNew($user->id, html_entity_decode($status, ENT_NOQUOTES, 'UTF-8'),
14353 - $source, 1, $reply_to);
14354 + $notice = Notice::saveNew($user->id, html_entity_decode($status, ENT_NOQUOTES, 'UTF-8'),
14355 + $source, 1, $reply_to);
14356 hunk ./actions/twitapistatuses.php 312
14357 - if (is_string($notice)) {
14358 - $this->server_error($notice);
14361 + if (is_string($notice)) {
14362 + $this->server_error($notice);
14365 hunk ./actions/twitapistatuses.php 317
14366 - common_broadcast_notice($notice);
14367 - $apidata['api_arg'] = $notice->id;
14369 + common_broadcast_notice($notice);
14370 + $apidata['api_arg'] = $notice->id;
14372 hunk ./actions/twitapistatuses.php 321
14373 - $this->show($args, $apidata);
14375 + $this->show($args, $apidata);
14377 hunk ./actions/twitapistatuses.php 324
14378 - function replies($args, $apidata) {
14379 + function replies($args, $apidata) {
14380 hunk ./actions/twitapistatuses.php 326
14381 - parent::handle($args);
14382 + parent::handle($args);
14383 hunk ./actions/twitapistatuses.php 328
14384 - $since = $this->arg('since');
14385 - $count = $this->arg('count');
14386 - $page = $this->arg('page');
14387 - $since_id = $this->arg('since_id');
14388 - $before_id = $this->arg('before_id');
14389 + $since = $this->arg('since');
14390 + $count = $this->arg('count');
14391 + $page = $this->arg('page');
14392 + $since_id = $this->arg('since_id');
14393 + $before_id = $this->arg('before_id');
14394 hunk ./actions/twitapistatuses.php 334
14395 - $this->auth_user = $apidata['user'];
14396 - $user = $this->auth_user;
14397 - $profile = $user->getProfile();
14398 + $this->auth_user = $apidata['user'];
14399 + $user = $this->auth_user;
14400 + $profile = $user->getProfile();
14401 hunk ./actions/twitapistatuses.php 338
14402 - $sitename = common_config('site', 'name');
14403 - $siteserver = common_config('site', 'server');
14404 + $sitename = common_config('site', 'name');
14405 + $siteserver = common_config('site', 'server');
14406 hunk ./actions/twitapistatuses.php 341
14407 - $title = sprintf(_('%1$s / Updates replying to %2$s'), $sitename, $user->nickname);
14408 - $id = "tag:$siteserver:replies:".$user->id;
14409 - $link = common_local_url('replies', array('nickname' => $user->nickname));
14410 - $subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $user->nickname, $profile->getBestName());
14411 + $title = sprintf(_('%1$s / Updates replying to %2$s'), $sitename, $user->nickname);
14412 + $id = "tag:$siteserver:replies:".$user->id;
14413 + $link = common_local_url('replies', array('nickname' => $user->nickname));
14414 + $subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $user->nickname, $profile->getBestName());
14415 hunk ./actions/twitapistatuses.php 346
14422 hunk ./actions/twitapistatuses.php 350
14429 hunk ./actions/twitapistatuses.php 354
14430 - if (!$since_id) {
14433 + if (!$since_id) {
14436 hunk ./actions/twitapistatuses.php 358
14437 - // NOTE: before_id is an extension to Twitter API -- TB
14438 - if (!$before_id) {
14441 + // NOTE: before_id is an extension to Twitter API -- TB
14442 + if (!$before_id) {
14445 hunk ./actions/twitapistatuses.php 363
14446 - $since = strtotime($this->arg('since'));
14447 + $since = strtotime($this->arg('since'));
14448 hunk ./actions/twitapistatuses.php 365
14449 - $notice = $user->getReplies((($page-1)*20), $count, $since_id, $before_id, $since);
14450 - $notices = array();
14451 + $notice = $user->getReplies((($page-1)*20), $count, $since_id, $before_id, $since);
14452 + $notices = array();
14453 hunk ./actions/twitapistatuses.php 368
14454 - while ($notice->fetch()) {
14455 - $notices[] = clone($notice);
14457 + while ($notice->fetch()) {
14458 + $notices[] = clone($notice);
14460 hunk ./actions/twitapistatuses.php 372
14461 - switch($apidata['content-type']) {
14463 - $this->show_xml_timeline($notices);
14466 - $this->show_rss_timeline($notices, $title, $link, $subtitle);
14469 - $this->show_atom_timeline($notices, $title, $id, $link, $subtitle);
14472 - $this->show_json_timeline($notices);
14475 - common_user_error(_('API method not found!'), $code = 404);
14477 + switch($apidata['content-type']) {
14479 + $this->show_xml_timeline($notices);
14482 + $this->show_rss_timeline($notices, $title, $link, $subtitle);
14485 + $this->show_atom_timeline($notices, $title, $id, $link, $subtitle);
14488 + $this->show_json_timeline($notices);
14491 + common_user_error(_('API method not found!'), $code = 404);
14493 hunk ./actions/twitapistatuses.php 389
14496 hunk ./actions/twitapistatuses.php 391
14497 - function show($args, $apidata) {
14498 - parent::handle($args);
14499 + function show($args, $apidata) {
14500 + parent::handle($args);
14501 hunk ./actions/twitapistatuses.php 394
14502 - if (!in_array($apidata['content-type'], array('xml', 'json'))) {
14503 - common_user_error(_('API method not found!'), $code = 404);
14506 + if (!in_array($apidata['content-type'], array('xml', 'json'))) {
14507 + common_user_error(_('API method not found!'), $code = 404);
14510 hunk ./actions/twitapistatuses.php 399
14511 - $this->auth_user = $apidata['user'];
14512 - $notice_id = $apidata['api_arg'];
14513 - $notice = Notice::staticGet($notice_id);
14514 + $this->auth_user = $apidata['user'];
14515 + $notice_id = $apidata['api_arg'];
14516 + $notice = Notice::staticGet($notice_id);
14517 hunk ./actions/twitapistatuses.php 403
14519 - if ($apidata['content-type'] == 'xml') {
14520 - $this->show_single_xml_status($notice);
14521 - } elseif ($apidata['content-type'] == 'json') {
14522 - $this->show_single_json_status($notice);
14525 - // XXX: Twitter just sets a 404 header and doens't bother to return an err msg
14526 - $this->client_error(_('No status with that ID found.'), 404, $apidata['content-type']);
14529 + if ($apidata['content-type'] == 'xml') {
14530 + $this->show_single_xml_status($notice);
14531 + } elseif ($apidata['content-type'] == 'json') {
14532 + $this->show_single_json_status($notice);
14535 + // XXX: Twitter just sets a 404 header and doens't bother to return an err msg
14536 + $this->client_error(_('No status with that ID found.'), 404, $apidata['content-type']);
14538 hunk ./actions/twitapistatuses.php 414
14541 hunk ./actions/twitapistatuses.php 416
14542 - function destroy($args, $apidata) {
14543 + function destroy($args, $apidata) {
14544 hunk ./actions/twitapistatuses.php 418
14545 - parent::handle($args);
14546 + parent::handle($args);
14547 hunk ./actions/twitapistatuses.php 420
14548 - if (!in_array($apidata['content-type'], array('xml', 'json'))) {
14549 - common_user_error(_('API method not found!'), $code = 404);
14552 + if (!in_array($apidata['content-type'], array('xml', 'json'))) {
14553 + common_user_error(_('API method not found!'), $code = 404);
14556 hunk ./actions/twitapistatuses.php 425
14557 - // Check for RESTfulness
14558 - if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
14559 - // XXX: Twitter just prints the err msg, no XML / JSON.
14560 - $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
14563 + // Check for RESTfulness
14564 + if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
14565 + // XXX: Twitter just prints the err msg, no XML / JSON.
14566 + $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
14569 hunk ./actions/twitapistatuses.php 432
14570 - $this->auth_user = $apidata['user'];
14571 - $user = $this->auth_user;
14572 - $notice_id = $apidata['api_arg'];
14573 - $notice = Notice::staticGet($notice_id);
14574 + $this->auth_user = $apidata['user'];
14575 + $user = $this->auth_user;
14576 + $notice_id = $apidata['api_arg'];
14577 + $notice = Notice::staticGet($notice_id);
14578 hunk ./actions/twitapistatuses.php 437
14580 - $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
14584 + $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
14587 hunk ./actions/twitapistatuses.php 442
14588 - if ($user->id == $notice->profile_id) {
14589 - $replies = new Reply;
14590 - $replies->get('notice_id', $notice_id);
14591 - common_dequeue_notice($notice);
14592 - $replies->delete();
14593 - $notice->delete();
14594 + if ($user->id == $notice->profile_id) {
14595 + $replies = new Reply;
14596 + $replies->get('notice_id', $notice_id);
14597 + common_dequeue_notice($notice);
14598 + $replies->delete();
14599 + $notice->delete();
14600 hunk ./actions/twitapistatuses.php 449
14601 - if ($apidata['content-type'] == 'xml') {
14602 - $this->show_single_xml_status($notice);
14603 - } elseif ($apidata['content-type'] == 'json') {
14604 - $this->show_single_json_status($notice);
14607 - $this->client_error(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
14609 + if ($apidata['content-type'] == 'xml') {
14610 + $this->show_single_xml_status($notice);
14611 + } elseif ($apidata['content-type'] == 'json') {
14612 + $this->show_single_json_status($notice);
14615 + $this->client_error(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
14617 hunk ./actions/twitapistatuses.php 458
14620 hunk ./actions/twitapistatuses.php 460
14621 - function friends($args, $apidata) {
14622 - parent::handle($args);
14623 - return $this->subscriptions($apidata, 'subscribed', 'subscriber');
14625 + function friends($args, $apidata) {
14626 + parent::handle($args);
14627 + return $this->subscriptions($apidata, 'subscribed', 'subscriber');
14629 hunk ./actions/twitapistatuses.php 465
14630 - function followers($args, $apidata) {
14631 - parent::handle($args);
14632 + function followers($args, $apidata) {
14633 + parent::handle($args);
14634 hunk ./actions/twitapistatuses.php 468
14635 - return $this->subscriptions($apidata, 'subscriber', 'subscribed');
14637 + return $this->subscriptions($apidata, 'subscriber', 'subscribed');
14639 hunk ./actions/twitapistatuses.php 471
14640 - function subscriptions($apidata, $other_attr, $user_attr) {
14641 + function subscriptions($apidata, $other_attr, $user_attr) {
14642 hunk ./actions/twitapistatuses.php 473
14645 hunk ./actions/twitapistatuses.php 475
14646 - $this->auth_user = $apidate['user'];
14647 - $user = $this->get_user($apidata['api_arg'], $apidata);
14648 + $this->auth_user = $apidate['user'];
14649 + $user = $this->get_user($apidata['api_arg'], $apidata);
14650 hunk ./actions/twitapistatuses.php 478
14652 - $this->client_error('Not Found', 404, $apidata['content-type']);
14656 + $this->client_error('Not Found', 404, $apidata['content-type']);
14659 hunk ./actions/twitapistatuses.php 483
14660 - $page = $this->trimmed('page');
14661 + $page = $this->trimmed('page');
14662 hunk ./actions/twitapistatuses.php 485
14663 - if (!$page || !is_numeric($page)) {
14666 + if (!$page || !is_numeric($page)) {
14669 hunk ./actions/twitapistatuses.php 489
14670 - $profile = $user->getProfile();
14671 + $profile = $user->getProfile();
14672 hunk ./actions/twitapistatuses.php 491
14674 - common_server_error(_('User has no profile.'));
14678 + common_server_error(_('User has no profile.'));
14681 hunk ./actions/twitapistatuses.php 496
14682 - $sub = new Subscription();
14683 - $sub->$user_attr = $profile->id;
14684 + $sub = new Subscription();
14685 + $sub->$user_attr = $profile->id;
14686 hunk ./actions/twitapistatuses.php 499
14687 - $since = strtotime($this->trimmed('since'));
14688 + $since = strtotime($this->trimmed('since'));
14689 hunk ./actions/twitapistatuses.php 501
14691 - $d = date('Y-m-d H:i:s', $since);
14692 - $sub->whereAdd("created > '$d'");
14695 + $d = date('Y-m-d H:i:s', $since);
14696 + $sub->whereAdd("created > '$d'");
14698 hunk ./actions/twitapistatuses.php 506
14699 - $sub->orderBy('created DESC');
14700 - $sub->limit(($page-1)*100, 100);
14701 + $sub->orderBy('created DESC');
14702 + $sub->limit(($page-1)*100, 100);
14703 hunk ./actions/twitapistatuses.php 509
14704 - $others = array();
14705 + $others = array();
14706 hunk ./actions/twitapistatuses.php 511
14707 - if ($sub->find()) {
14708 - while ($sub->fetch()) {
14709 - $others[] = Profile::staticGet($sub->$other_attr);
14712 - // user has no followers
14714 + if ($sub->find()) {
14715 + while ($sub->fetch()) {
14716 + $others[] = Profile::staticGet($sub->$other_attr);
14719 + // user has no followers
14721 hunk ./actions/twitapistatuses.php 519
14722 - $type = $apidata['content-type'];
14723 + $type = $apidata['content-type'];
14724 hunk ./actions/twitapistatuses.php 521
14725 - $this->init_document($type);
14726 - $this->show_profiles($others, $type);
14727 - $this->end_document($type);
14729 + $this->init_document($type);
14730 + $this->show_profiles($others, $type);
14731 + $this->end_document($type);
14733 hunk ./actions/twitapistatuses.php 526
14734 - function show_profiles($profiles, $type) {
14737 - common_element_start('users', array('type' => 'array'));
14738 - foreach ($profiles as $profile) {
14739 - $this->show_profile($profile);
14741 - common_element_end('users');
14744 - $arrays = array();
14745 - foreach ($profiles as $profile) {
14746 - $arrays[] = $this->twitter_user_array($profile, true);
14748 - print json_encode($arrays);
14751 - $this->client_error(_('unsupported file type'));
14754 + function show_profiles($profiles, $type) {
14757 + common_element_start('users', array('type' => 'array'));
14758 + foreach ($profiles as $profile) {
14759 + $this->show_profile($profile);
14761 + common_element_end('users');
14764 + $arrays = array();
14765 + foreach ($profiles as $profile) {
14766 + $arrays[] = $this->twitter_user_array($profile, true);
14768 + print json_encode($arrays);
14771 + $this->client_error(_('unsupported file type'));
14774 hunk ./actions/twitapistatuses.php 547
14775 - function featured($args, $apidata) {
14776 - parent::handle($args);
14777 - common_server_error(_('API method under construction.'), $code=501);
14779 + function featured($args, $apidata) {
14780 + parent::handle($args);
14781 + common_server_error(_('API method under construction.'), $code=501);
14783 hunk ./actions/twitapistatuses.php 552
14784 - function supported($cmd) {
14785 + function supported($cmd) {
14786 hunk ./actions/twitapistatuses.php 554
14787 - $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', 'FavCommand', 'OnCommand', 'OffCommand');
14788 + $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', 'FavCommand', 'OnCommand', 'OffCommand');
14789 hunk ./actions/twitapistatuses.php 556
14790 - if (in_array(get_class($cmd), $cmdlist)) {
14793 + if (in_array(get_class($cmd), $cmdlist)) {
14796 hunk ./actions/twitapistatuses.php 560
14801 hunk ./actions/twitapiusers.php 13
14802 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14803 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14804 hunk ./actions/twitapiusers.php 17
14805 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
14806 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
14807 hunk ./actions/twitapiusers.php 26
14808 - function show($args, $apidata) {
14809 - parent::handle($args);
14810 + function show($args, $apidata) {
14811 + parent::handle($args);
14812 hunk ./actions/twitapiusers.php 29
14813 - if (!in_array($apidata['content-type'], array('xml', 'json'))) {
14814 - common_user_error(_('API method not found!'), $code = 404);
14817 + if (!in_array($apidata['content-type'], array('xml', 'json'))) {
14818 + common_user_error(_('API method not found!'), $code = 404);
14821 hunk ./actions/twitapiusers.php 34
14823 - $email = $this->arg('email');
14825 + $email = $this->arg('email');
14826 hunk ./actions/twitapiusers.php 37
14828 - $user = User::staticGet('email', $email);
14829 - } elseif (isset($apidata['api_arg'])) {
14830 - $user = $this->get_user($apidata['api_arg']);
14833 + $user = User::staticGet('email', $email);
14834 + } elseif (isset($apidata['api_arg'])) {
14835 + $user = $this->get_user($apidata['api_arg']);
14837 hunk ./actions/twitapiusers.php 43
14839 - // XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach
14840 - $this->client_error(_('Not found.'), 404, $apidata['content-type']);
14844 + // XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach
14845 + $this->client_error(_('Not found.'), 404, $apidata['content-type']);
14848 hunk ./actions/twitapiusers.php 49
14849 - $this->show_extended_profile($user, $apidata);
14851 + $this->show_extended_profile($user, $apidata);
14853 hunk ./actions/twittersettings.php 28
14854 - function get_instructions() {
14855 - return _('Add your Twitter account to automatically send your notices to Twitter, ' .
14856 - 'and subscribe to Twitter friends already here.');
14858 + function get_instructions() {
14859 + return _('Add your Twitter account to automatically send your notices to Twitter, ' .
14860 + 'and subscribe to Twitter friends already here.');
14862 hunk ./actions/twittersettings.php 33
14863 - function show_form($msg=NULL, $success=false) {
14864 - $user = common_current_user();
14865 - $profile = $user->getProfile();
14867 - $flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter
14868 + function show_form($msg=NULL, $success=false) {
14869 + $user = common_current_user();
14870 + $profile = $user->getProfile();
14872 + $flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter
14873 hunk ./actions/twittersettings.php 39
14875 - $fuser = $flink->getForeignUser();
14878 + $fuser = $flink->getForeignUser();
14880 hunk ./actions/twittersettings.php 43
14881 - $this->form_header(_('Twitter settings'), $msg, $success);
14882 - common_element_start('form', array('method' => 'post',
14883 - 'id' => 'twittersettings',
14885 - common_local_url('twittersettings')));
14886 - common_hidden('token', common_session_token());
14887 + $this->form_header(_('Twitter settings'), $msg, $success);
14888 + common_element_start('form', array('method' => 'post',
14889 + 'id' => 'twittersettings',
14891 + common_local_url('twittersettings')));
14892 + common_hidden('token', common_session_token());
14893 hunk ./actions/twittersettings.php 50
14894 - common_element('h2', NULL, _('Twitter Account'));
14895 + common_element('h2', NULL, _('Twitter Account'));
14896 hunk ./actions/twittersettings.php 52
14898 - common_element_start('p');
14900 + common_element_start('p');
14901 hunk ./actions/twittersettings.php 55
14902 - common_element('span', 'twitter_user', $fuser->nickname);
14903 - common_element('a', array('href' => $fuser->uri), $fuser->uri);
14904 - common_element('span', 'input_instructions',
14905 - _('Current verified Twitter account.'));
14906 - common_hidden('flink_foreign_id', $flink->foreign_id);
14907 - common_element_end('p');
14908 - common_submit('remove', _('Remove'));
14910 - common_input('twitter_username', _('Twitter user name'),
14911 - ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
14912 - _('No spaces, please.')); // hey, it's what Twitter says
14913 + common_element('span', 'twitter_user', $fuser->nickname);
14914 + common_element('a', array('href' => $fuser->uri), $fuser->uri);
14915 + common_element('span', 'input_instructions',
14916 + _('Current verified Twitter account.'));
14917 + common_hidden('flink_foreign_id', $flink->foreign_id);
14918 + common_element_end('p');
14919 + common_submit('remove', _('Remove'));
14921 + common_input('twitter_username', _('Twitter user name'),
14922 + ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
14923 + _('No spaces, please.')); // hey, it's what Twitter says
14924 hunk ./actions/twittersettings.php 67
14925 - common_password('twitter_password', _('Twitter password'));
14927 + common_password('twitter_password', _('Twitter password'));
14929 hunk ./actions/twittersettings.php 70
14930 - common_element('h2', NULL, _('Preferences'));
14931 + common_element('h2', NULL, _('Preferences'));
14932 hunk ./actions/twittersettings.php 72
14933 - common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
14934 - ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
14935 + common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
14936 + ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
14937 hunk ./actions/twittersettings.php 75
14938 - common_checkbox('replysync', _('Send local "@" replies to Twitter.'),
14939 - ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
14940 + common_checkbox('replysync', _('Send local "@" replies to Twitter.'),
14941 + ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
14942 hunk ./actions/twittersettings.php 78
14943 - common_checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
14944 - ($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false);
14945 + common_checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
14946 + ($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false);
14947 hunk ./actions/twittersettings.php 81
14949 - common_submit('save', _('Save'));
14951 - common_submit('add', _('Add'));
14954 + common_submit('save', _('Save'));
14956 + common_submit('add', _('Add'));
14958 hunk ./actions/twittersettings.php 87
14959 - $this->show_twitter_subscriptions();
14960 + $this->show_twitter_subscriptions();
14961 hunk ./actions/twittersettings.php 89
14962 - common_element_end('form');
14963 + common_element_end('form');
14964 hunk ./actions/twittersettings.php 91
14965 - common_show_footer();
14967 + common_show_footer();
14969 hunk ./actions/twittersettings.php 94
14970 - function subscribed_twitter_users() {
14971 + function subscribed_twitter_users() {
14972 hunk ./actions/twittersettings.php 96
14973 - $current_user = common_current_user();
14974 + $current_user = common_current_user();
14975 hunk ./actions/twittersettings.php 98
14976 - $qry = 'SELECT user.* ' .
14977 - 'FROM subscription ' .
14978 - 'JOIN user ON subscription.subscribed = user.id ' .
14979 - 'JOIN foreign_link ON foreign_link.user_id = user.id ' .
14980 - 'WHERE subscriber = %d ' .
14981 - 'ORDER BY user.nickname';
14982 + $qry = 'SELECT user.* ' .
14983 + 'FROM subscription ' .
14984 + 'JOIN user ON subscription.subscribed = user.id ' .
14985 + 'JOIN foreign_link ON foreign_link.user_id = user.id ' .
14986 + 'WHERE subscriber = %d ' .
14987 + 'ORDER BY user.nickname';
14988 hunk ./actions/twittersettings.php 105
14989 - $user = new User();
14990 + $user = new User();
14991 hunk ./actions/twittersettings.php 107
14992 - $user->query(sprintf($qry, $current_user->id));
14993 + $user->query(sprintf($qry, $current_user->id));
14994 hunk ./actions/twittersettings.php 109
14995 - $users = array();
14996 + $users = array();
14997 hunk ./actions/twittersettings.php 111
14998 - while ($user->fetch()) {
14999 + while ($user->fetch()) {
15000 hunk ./actions/twittersettings.php 113
15001 - // Don't include the user's own self-subscription
15002 - if ($user->id != $current_user->id) {
15003 - $users[] = clone($user);
15006 + // Don't include the user's own self-subscription
15007 + if ($user->id != $current_user->id) {
15008 + $users[] = clone($user);
15011 hunk ./actions/twittersettings.php 119
15016 hunk ./actions/twittersettings.php 122
15017 - function show_twitter_subscriptions() {
15018 + function show_twitter_subscriptions() {
15019 hunk ./actions/twittersettings.php 124
15020 - $friends = $this->subscribed_twitter_users();
15021 - $friends_count = count($friends);
15022 + $friends = $this->subscribed_twitter_users();
15023 + $friends_count = count($friends);
15024 hunk ./actions/twittersettings.php 127
15025 - if ($friends_count > 0) {
15026 + if ($friends_count > 0) {
15027 hunk ./actions/twittersettings.php 129
15028 - common_element('h3', NULL, _('Twitter Friends'));
15029 - common_element_start('div', array('id' => 'subscriptions'));
15030 - common_element_start('ul', array('id' => 'subscriptions_avatars'));
15031 + common_element('h3', NULL, _('Twitter Friends'));
15032 + common_element_start('div', array('id' => 'subscriptions'));
15033 + common_element_start('ul', array('id' => 'subscriptions_avatars'));
15034 hunk ./actions/twittersettings.php 133
15035 - for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
15036 + for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
15037 hunk ./actions/twittersettings.php 135
15038 - $other = Profile::staticGet($friends[$i]->id);
15039 + $other = Profile::staticGet($friends[$i]->id);
15040 hunk ./actions/twittersettings.php 137
15042 - common_log_db_error($subs, 'SELECT', __FILE__);
15046 + common_log_db_error($subs, 'SELECT', __FILE__);
15049 hunk ./actions/twittersettings.php 142
15050 - common_element_start('li');
15051 - common_element_start('a', array('title' => ($other->fullname) ?
15052 - $other->fullname :
15053 - $other->nickname,
15054 - 'href' => $other->profileurl,
15055 - 'rel' => 'contact',
15056 - 'class' => 'subscription'));
15057 - $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
15058 - common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
15059 - 'width' => AVATAR_MINI_SIZE,
15060 - 'height' => AVATAR_MINI_SIZE,
15061 - 'class' => 'avatar mini',
15062 - 'alt' => ($other->fullname) ?
15063 - $other->fullname :
15064 - $other->nickname));
15065 - common_element_end('a');
15066 - common_element_end('li');
15067 + common_element_start('li');
15068 + common_element_start('a', array('title' => ($other->fullname) ?
15069 + $other->fullname :
15070 + $other->nickname,
15071 + 'href' => $other->profileurl,
15072 + 'rel' => 'contact',
15073 + 'class' => 'subscription'));
15074 + $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
15075 + common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
15076 + 'width' => AVATAR_MINI_SIZE,
15077 + 'height' => AVATAR_MINI_SIZE,
15078 + 'class' => 'avatar mini',
15079 + 'alt' => ($other->fullname) ?
15080 + $other->fullname :
15081 + $other->nickname));
15082 + common_element_end('a');
15083 + common_element_end('li');
15084 hunk ./actions/twittersettings.php 160
15087 hunk ./actions/twittersettings.php 162
15088 - common_element_end('ul');
15089 - common_element_end('div');
15090 + common_element_end('ul');
15091 + common_element_end('div');
15092 hunk ./actions/twittersettings.php 165
15095 hunk ./actions/twittersettings.php 167
15096 - // XXX Figure out a way to show all Twitter friends... ?
15097 + // XXX Figure out a way to show all Twitter friends... ?
15098 hunk ./actions/twittersettings.php 169
15100 - if ($subs_count > SUBSCRIPTIONS) {
15101 - common_element_start('p', array('id' => 'subscriptions_viewall'));
15103 + if ($subs_count > SUBSCRIPTIONS) {
15104 + common_element_start('p', array('id' => 'subscriptions_viewall'));
15105 hunk ./actions/twittersettings.php 173
15106 - common_element('a', array('href' => common_local_url('subscriptions',
15107 - array('nickname' => $profile->nickname)),
15108 - 'class' => 'moresubscriptions'),
15109 - _('All subscriptions'));
15110 - common_element_end('p');
15113 + common_element('a', array('href' => common_local_url('subscriptions',
15114 + array('nickname' => $profile->nickname)),
15115 + 'class' => 'moresubscriptions'),
15116 + _('All subscriptions'));
15117 + common_element_end('p');
15120 hunk ./actions/twittersettings.php 181
15123 hunk ./actions/twittersettings.php 183
15124 - function handle_post() {
15125 + function handle_post() {
15126 hunk ./actions/twittersettings.php 185
15127 - # CSRF protection
15128 - $token = $this->trimmed('token');
15129 - if (!$token || $token != common_session_token()) {
15130 - $this->show_form(_('There was a problem with your session token. Try again, please.'));
15133 + # CSRF protection
15134 + $token = $this->trimmed('token');
15135 + if (!$token || $token != common_session_token()) {
15136 + $this->show_form(_('There was a problem with your session token. Try again, please.'));
15139 hunk ./actions/twittersettings.php 192
15140 - if ($this->arg('save')) {
15141 - $this->save_preferences();
15142 - } else if ($this->arg('add')) {
15143 - $this->add_twitter_acct();
15144 - } else if ($this->arg('remove')) {
15145 - $this->remove_twitter_acct();
15147 - $this->show_form(_('Unexpected form submission.'));
15150 + if ($this->arg('save')) {
15151 + $this->save_preferences();
15152 + } else if ($this->arg('add')) {
15153 + $this->add_twitter_acct();
15154 + } else if ($this->arg('remove')) {
15155 + $this->remove_twitter_acct();
15157 + $this->show_form(_('Unexpected form submission.'));
15160 hunk ./actions/twittersettings.php 203
15161 - function add_twitter_acct() {
15162 + function add_twitter_acct() {
15163 hunk ./actions/twittersettings.php 205
15164 - $screen_name = $this->trimmed('twitter_username');
15165 - $password = $this->trimmed('twitter_password');
15166 - $noticesync = $this->boolean('noticesync');
15167 - $replysync = $this->boolean('replysync');
15168 - $friendsync = $this->boolean('friendsync');
15169 + $screen_name = $this->trimmed('twitter_username');
15170 + $password = $this->trimmed('twitter_password');
15171 + $noticesync = $this->boolean('noticesync');
15172 + $replysync = $this->boolean('replysync');
15173 + $friendsync = $this->boolean('friendsync');
15174 hunk ./actions/twittersettings.php 211
15175 - if (!Validate::string($screen_name,
15176 - array( 'min_length' => 1,
15177 - 'max_length' => 15,
15178 - 'format' => VALIDATE_NUM . VALIDATE_ALPHA . '_'))) {
15179 - $this->show_form(
15180 - _('Username must have only numbers, upper- and lowercase letters, and underscore (_). 15 chars max.'));
15183 + if (!Validate::string($screen_name,
15184 + array( 'min_length' => 1,
15185 + 'max_length' => 15,
15186 + 'format' => VALIDATE_NUM . VALIDATE_ALPHA . '_'))) {
15187 + $this->show_form(
15188 + _('Username must have only numbers, upper- and lowercase letters, and underscore (_). 15 chars max.'));
15191 hunk ./actions/twittersettings.php 220
15192 - if (!$this->verify_credentials($screen_name, $password)) {
15193 - $this->show_form(_('Could not verify your Twitter credentials!'));
15196 + if (!$this->verify_credentials($screen_name, $password)) {
15197 + $this->show_form(_('Could not verify your Twitter credentials!'));
15200 hunk ./actions/twittersettings.php 225
15201 - $twit_user = twitter_user_info($screen_name, $password);
15202 + $twit_user = twitter_user_info($screen_name, $password);
15203 hunk ./actions/twittersettings.php 227
15204 - if (!$twit_user) {
15205 - $this->show_form(sprintf(_('Unable to retrieve account information for "%s" from Twitter.'),
15209 + if (!$twit_user) {
15210 + $this->show_form(sprintf(_('Unable to retrieve account information for "%s" from Twitter.'),
15214 hunk ./actions/twittersettings.php 233
15215 - if (!save_twitter_user($twit_user->id, $screen_name)) {
15216 - $this->show_form(_('Unable to save your Twitter settings!'));
15219 + if (!save_twitter_user($twit_user->id, $screen_name)) {
15220 + $this->show_form(_('Unable to save your Twitter settings!'));
15223 hunk ./actions/twittersettings.php 238
15224 - $user = common_current_user();
15225 + $user = common_current_user();
15226 hunk ./actions/twittersettings.php 240
15227 - $flink = DB_DataObject::factory('foreign_link');
15228 - $flink->user_id = $user->id;
15229 - $flink->foreign_id = $twit_user->id;
15230 - $flink->service = 1; // Twitter
15231 - $flink->credentials = $password;
15232 - $flink->created = common_sql_now();
15233 + $flink = DB_DataObject::factory('foreign_link');
15234 + $flink->user_id = $user->id;
15235 + $flink->foreign_id = $twit_user->id;
15236 + $flink->service = 1; // Twitter
15237 + $flink->credentials = $password;
15238 + $flink->created = common_sql_now();
15239 hunk ./actions/twittersettings.php 247
15240 - $this->set_flags($flink, $noticesync, $replysync, $friendsync);
15241 + $this->set_flags($flink, $noticesync, $replysync, $friendsync);
15242 hunk ./actions/twittersettings.php 249
15243 - $flink_id = $flink->insert();
15244 + $flink_id = $flink->insert();
15245 hunk ./actions/twittersettings.php 251
15246 - if (!$flink_id) {
15247 - common_log_db_error($flink, 'INSERT', __FILE__);
15248 - $this->show_form(_('Unable to save your Twitter settings!'));
15251 + if (!$flink_id) {
15252 + common_log_db_error($flink, 'INSERT', __FILE__);
15253 + $this->show_form(_('Unable to save your Twitter settings!'));
15256 hunk ./actions/twittersettings.php 257
15257 - if ($friendsync) {
15258 - save_twitter_friends($user, $twit_user->id, $screen_name, $password);
15260 + if ($friendsync) {
15261 + save_twitter_friends($user, $twit_user->id, $screen_name, $password);
15263 hunk ./actions/twittersettings.php 261
15264 - $this->show_form(_('Twitter settings saved.'), true);
15266 + $this->show_form(_('Twitter settings saved.'), true);
15268 hunk ./actions/twittersettings.php 264
15269 - function remove_twitter_acct() {
15270 + function remove_twitter_acct() {
15271 hunk ./actions/twittersettings.php 266
15272 - $user = common_current_user();
15273 - $flink = Foreign_link::getByUserID($user->id, 1);
15274 - $flink_foreign_id = $this->arg('flink_foreign_id');
15275 + $user = common_current_user();
15276 + $flink = Foreign_link::getByUserID($user->id, 1);
15277 + $flink_foreign_id = $this->arg('flink_foreign_id');
15278 hunk ./actions/twittersettings.php 270
15279 - # Maybe an old tab open...?
15280 - if ($flink->foreign_id != $flink_foreign_id) {
15281 - $this->show_form(_('That is not your Twitter account.'));
15284 + # Maybe an old tab open...?
15285 + if ($flink->foreign_id != $flink_foreign_id) {
15286 + $this->show_form(_('That is not your Twitter account.'));
15289 hunk ./actions/twittersettings.php 276
15290 - $result = $flink->delete();
15291 + $result = $flink->delete();
15292 hunk ./actions/twittersettings.php 278
15294 - common_log_db_error($flink, 'DELETE', __FILE__);
15295 - common_server_error(_('Couldn\'t remove Twitter user.'));
15299 + common_log_db_error($flink, 'DELETE', __FILE__);
15300 + common_server_error(_('Couldn\'t remove Twitter user.'));
15303 hunk ./actions/twittersettings.php 284
15304 - $this->show_form(_('Twitter account removed.'), TRUE);
15306 + $this->show_form(_('Twitter account removed.'), TRUE);
15308 hunk ./actions/twittersettings.php 287
15309 - function save_preferences() {
15310 + function save_preferences() {
15311 hunk ./actions/twittersettings.php 289
15312 - $noticesync = $this->boolean('noticesync');
15313 - $friendsync = $this->boolean('friendsync');
15314 - $replysync = $this->boolean('replysync');
15315 + $noticesync = $this->boolean('noticesync');
15316 + $friendsync = $this->boolean('friendsync');
15317 + $replysync = $this->boolean('replysync');
15318 hunk ./actions/twittersettings.php 293
15319 - $user = common_current_user();
15320 + $user = common_current_user();
15321 hunk ./actions/twittersettings.php 295
15322 - $flink = Foreign_link::getByUserID($user->id, 1);
15323 + $flink = Foreign_link::getByUserID($user->id, 1);
15324 hunk ./actions/twittersettings.php 297
15326 - common_log_db_error($flink, 'SELECT', __FILE__);
15327 - $this->show_form(_('Couldn\'t save Twitter preferences.'));
15331 + common_log_db_error($flink, 'SELECT', __FILE__);
15332 + $this->show_form(_('Couldn\'t save Twitter preferences.'));
15335 hunk ./actions/twittersettings.php 303
15336 - $twitter_id = $flink->foreign_id;
15337 - $password = $flink->credentials;
15338 + $twitter_id = $flink->foreign_id;
15339 + $password = $flink->credentials;
15340 hunk ./actions/twittersettings.php 306
15341 - $fuser = $flink->getForeignUser();
15342 + $fuser = $flink->getForeignUser();
15343 hunk ./actions/twittersettings.php 308
15345 - common_log_db_error($fuser, 'SELECT', __FILE__);
15346 - $this->show_form(_('Couldn\'t save Twitter preferences.'));
15350 + common_log_db_error($fuser, 'SELECT', __FILE__);
15351 + $this->show_form(_('Couldn\'t save Twitter preferences.'));
15354 hunk ./actions/twittersettings.php 314
15355 - $screen_name = $fuser->nickname;
15356 + $screen_name = $fuser->nickname;
15357 hunk ./actions/twittersettings.php 316
15358 - $original = clone($flink);
15359 - $this->set_flags($flink, $noticesync, $replysync, $friendsync);
15360 - $result = $flink->update($original);
15361 + $original = clone($flink);
15362 + $this->set_flags($flink, $noticesync, $replysync, $friendsync);
15363 + $result = $flink->update($original);
15364 hunk ./actions/twittersettings.php 320
15365 - if ($result === FALSE) {
15366 - common_log_db_error($flink, 'UPDATE', __FILE__);
15367 - $this->show_form(_('Couldn\'t save Twitter preferences.'));
15370 + if ($result === FALSE) {
15371 + common_log_db_error($flink, 'UPDATE', __FILE__);
15372 + $this->show_form(_('Couldn\'t save Twitter preferences.'));
15375 hunk ./actions/twittersettings.php 326
15376 - if ($friendsync) {
15377 - save_twitter_friends($user, $flink->foreign_id, $screen_name, $password);
15379 + if ($friendsync) {
15380 + save_twitter_friends($user, $flink->foreign_id, $screen_name, $password);
15382 hunk ./actions/twittersettings.php 330
15383 - $this->show_form(_('Twitter preferences saved.'));
15385 + $this->show_form(_('Twitter preferences saved.'));
15387 hunk ./actions/twittersettings.php 333
15388 - function verify_credentials($screen_name, $password) {
15389 - $uri = 'http://twitter.com/account/verify_credentials.json';
15390 - $data = get_twitter_data($uri, $screen_name, $password);
15391 + function verify_credentials($screen_name, $password) {
15392 + $uri = 'http://twitter.com/account/verify_credentials.json';
15393 + $data = get_twitter_data($uri, $screen_name, $password);
15394 hunk ./actions/twittersettings.php 337
15401 hunk ./actions/twittersettings.php 341
15402 - $user = json_decode($data);
15403 + $user = json_decode($data);
15404 hunk ./actions/twittersettings.php 343
15411 hunk ./actions/twittersettings.php 347
15412 - $twitter_id = $user->status->id;
15413 + $twitter_id = $user->status->id;
15414 hunk ./actions/twittersettings.php 349
15415 - if ($twitter_id) {
15416 - return $twitter_id;
15418 + if ($twitter_id) {
15419 + return $twitter_id;
15421 hunk ./actions/twittersettings.php 353
15426 hunk ./actions/twittersettings.php 356
15427 - function set_flags(&$flink, $noticesync, $replysync, $friendsync) {
15428 - if ($noticesync) {
15429 - $flink->noticesync |= FOREIGN_NOTICE_SEND;
15431 - $flink->noticesync &= ~FOREIGN_NOTICE_SEND;
15433 + function set_flags(&$flink, $noticesync, $replysync, $friendsync) {
15434 + if ($noticesync) {
15435 + $flink->noticesync |= FOREIGN_NOTICE_SEND;
15437 + $flink->noticesync &= ~FOREIGN_NOTICE_SEND;
15439 hunk ./actions/twittersettings.php 363
15440 - if ($replysync) {
15441 - $flink->noticesync |= FOREIGN_NOTICE_SEND_REPLY;
15443 - $flink->noticesync &= ~FOREIGN_NOTICE_SEND_REPLY;
15445 + if ($replysync) {
15446 + $flink->noticesync |= FOREIGN_NOTICE_SEND_REPLY;
15448 + $flink->noticesync &= ~FOREIGN_NOTICE_SEND_REPLY;
15450 hunk ./actions/twittersettings.php 369
15451 - if ($friendsync) {
15452 - $flink->friendsync |= FOREIGN_FRIEND_RECV;
15454 - $flink->friendsync &= ~FOREIGN_FRIEND_RECV;
15456 + if ($friendsync) {
15457 + $flink->friendsync |= FOREIGN_FRIEND_RECV;
15459 + $flink->friendsync &= ~FOREIGN_FRIEND_RECV;
15461 hunk ./actions/twittersettings.php 375
15462 - $flink->profilesync = 0;
15464 + $flink->profilesync = 0;
15466 hunk ./actions/unblock.php 35
15467 - $token = $this->trimmed('token');
15468 + $token = $this->trimmed('token');
15469 hunk ./actions/unblock.php 37
15470 - if (!$token || $token != common_session_token()) {
15471 - $this->client_error(_('There was a problem with your session token. Try again, please.'));
15474 + if (!$token || $token != common_session_token()) {
15475 + $this->client_error(_('There was a problem with your session token. Try again, please.'));
15478 hunk ./actions/unsubscribe.php 22
15479 - function handle($args) {
15480 - parent::handle($args);
15481 - if (!common_logged_in()) {
15482 - common_user_error(_('Not logged in.'));
15485 + function handle($args) {
15486 + parent::handle($args);
15487 + if (!common_logged_in()) {
15488 + common_user_error(_('Not logged in.'));
15491 hunk ./actions/unsubscribe.php 29
15492 - $user = common_current_user();
15493 + $user = common_current_user();
15494 hunk ./actions/unsubscribe.php 31
15495 - if ($_SERVER['REQUEST_METHOD'] != 'POST') {
15496 - common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
15499 + if ($_SERVER['REQUEST_METHOD'] != 'POST') {
15500 + common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
15503 hunk ./actions/unsubscribe.php 36
15504 - # CSRF protection
15505 + # CSRF protection
15506 hunk ./actions/unsubscribe.php 38
15507 - $token = $this->trimmed('token');
15508 + $token = $this->trimmed('token');
15509 hunk ./actions/unsubscribe.php 40
15510 - if (!$token || $token != common_session_token()) {
15511 - $this->client_error(_('There was a problem with your session token. Try again, please.'));
15514 + if (!$token || $token != common_session_token()) {
15515 + $this->client_error(_('There was a problem with your session token. Try again, please.'));
15518 hunk ./actions/unsubscribe.php 45
15519 - $other_id = $this->arg('unsubscribeto');
15520 + $other_id = $this->arg('unsubscribeto');
15521 hunk ./actions/unsubscribe.php 59
15522 - $result = subs_unsubscribe_to($user, $other);
15523 + $result = subs_unsubscribe_to($user, $other);
15524 hunk ./actions/unsubscribe.php 61
15525 - if ($result != true) {
15526 - common_user_error($result);
15529 + if ($result != true) {
15530 + common_user_error($result);
15533 hunk ./actions/unsubscribe.php 66
15534 - if ($this->boolean('ajax')) {
15535 - common_start_html('text/xml;charset=utf-8', true);
15536 - common_element_start('head');
15537 - common_element('title', null, _('Unsubscribed'));
15538 - common_element_end('head');
15539 - common_element_start('body');
15540 - common_subscribe_form($other);
15541 - common_element_end('body');
15542 - common_element_end('html');
15544 - common_redirect(common_local_url('subscriptions', array('nickname' =>
15545 - $user->nickname)));
15546 + if ($this->boolean('ajax')) {
15547 + common_start_html('text/xml;charset=utf-8', true);
15548 + common_element_start('head');
15549 + common_element('title', null, _('Unsubscribed'));
15550 + common_element_end('head');
15551 + common_element_start('body');
15552 + common_subscribe_form($other);
15553 + common_element_end('body');
15554 + common_element_end('html');
15556 + common_redirect(common_local_url('subscriptions', array('nickname' =>
15557 + $user->nickname)));
15558 hunk ./actions/unsubscribe.php 79
15561 hunk ./actions/updateprofile.php 25
15563 - function handle($args) {
15564 - parent::handle($args);
15566 - common_remove_magic_from_request();
15567 - $req = OAuthRequest::from_request();
15568 - # Note: server-to-server function!
15569 - $server = omb_oauth_server();
15570 - list($consumer, $token) = $server->verify_request($req);
15571 - if ($this->update_profile($req, $consumer, $token)) {
15572 - print "omb_version=".OMB_VERSION_01;
15574 - } catch (OAuthException $e) {
15575 - $this->server_error($e->getMessage());
15580 + function handle($args) {
15581 + parent::handle($args);
15583 + common_remove_magic_from_request();
15584 + $req = OAuthRequest::from_request();
15585 + # Note: server-to-server function!
15586 + $server = omb_oauth_server();
15587 + list($consumer, $token) = $server->verify_request($req);
15588 + if ($this->update_profile($req, $consumer, $token)) {
15589 + print "omb_version=".OMB_VERSION_01;
15591 + } catch (OAuthException $e) {
15592 + $this->server_error($e->getMessage());
15596 hunk ./actions/updateprofile.php 43
15597 - function update_profile($req, $consumer, $token) {
15598 - $version = $req->get_parameter('omb_version');
15599 - if ($version != OMB_VERSION_01) {
15600 - $this->client_error(_('Unsupported OMB version'), 400);
15603 - # First, check to see if listenee exists
15604 - $listenee = $req->get_parameter('omb_listenee');
15605 - $remote = Remote_profile::staticGet('uri', $listenee);
15607 - $this->client_error(_('Profile unknown'), 404);
15610 - # Second, check to see if they should be able to post updates!
15611 - # We see if there are any subscriptions to that remote user with
15612 - # the given token.
15613 + function update_profile($req, $consumer, $token) {
15614 + $version = $req->get_parameter('omb_version');
15615 + if ($version != OMB_VERSION_01) {
15616 + $this->client_error(_('Unsupported OMB version'), 400);
15619 + # First, check to see if listenee exists
15620 + $listenee = $req->get_parameter('omb_listenee');
15621 + $remote = Remote_profile::staticGet('uri', $listenee);
15623 + $this->client_error(_('Profile unknown'), 404);
15626 + # Second, check to see if they should be able to post updates!
15627 + # We see if there are any subscriptions to that remote user with
15628 + # the given token.
15629 hunk ./actions/updateprofile.php 60
15630 - $sub = new Subscription();
15631 - $sub->subscribed = $remote->id;
15632 - $sub->token = $token->key;
15633 - if (!$sub->find(true)) {
15634 - $this->client_error(_('You did not send us that profile'), 403);
15637 + $sub = new Subscription();
15638 + $sub->subscribed = $remote->id;
15639 + $sub->token = $token->key;
15640 + if (!$sub->find(true)) {
15641 + $this->client_error(_('You did not send us that profile'), 403);
15644 hunk ./actions/updateprofile.php 68
15645 - $profile = Profile::staticGet('id', $remote->id);
15647 - # This one is our fault
15648 - $this->server_error(_('Remote profile with no matching profile'), 500);
15651 - $nickname = $req->get_parameter('omb_listenee_nickname');
15652 - if ($nickname && !Validate::string($nickname, array('min_length' => 1,
15653 - 'max_length' => 64,
15654 - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
15655 - $this->client_error(_('Nickname must have only lowercase letters and numbers and no spaces.'));
15658 - $license = $req->get_parameter('omb_listenee_license');
15659 - if ($license && !common_valid_http_url($license)) {
15660 - $this->client_error(sprintf(_("Invalid license URL '%s'"), $license));
15663 - $profile_url = $req->get_parameter('omb_listenee_profile');
15664 - if ($profile_url && !common_valid_http_url($profile_url)) {
15665 - $this->client_error(sprintf(_("Invalid profile URL '%s'."), $profile_url));
15669 - $fullname = $req->get_parameter('omb_listenee_fullname');
15670 - if ($fullname && strlen($fullname) > 255) {
15671 - $this->client_error(_("Full name is too long (max 255 chars)."));
15674 - $homepage = $req->get_parameter('omb_listenee_homepage');
15675 - if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
15676 - $this->client_error(sprintf(_("Invalid homepage '%s'"), $homepage));
15679 - $bio = $req->get_parameter('omb_listenee_bio');
15680 - if ($bio && strlen($bio) > 140) {
15681 - $this->client_error(_("Bio is too long (max 140 chars)."));
15684 - $location = $req->get_parameter('omb_listenee_location');
15685 - if ($location && strlen($location) > 255) {
15686 - $this->client_error(_("Location is too long (max 255 chars)."));
15689 - $avatar = $req->get_parameter('omb_listenee_avatar');
15691 - if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
15692 - $this->client_error(sprintf(_("Invalid avatar URL '%s'"), $avatar));
15695 - $size = @getimagesize($avatar);
15697 - $this->client_error(sprintf(_("Can't read avatar URL '%s'"), $avatar));
15700 - if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
15701 - $this->client_error(sprintf(_("Wrong size image at '%s'"), $avatar));
15704 - if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
15705 - IMAGETYPE_PNG))) {
15706 - $this->client_error(sprintf(_("Wrong image type for '%s'"), $avatar));
15710 + $profile = Profile::staticGet('id', $remote->id);
15712 + # This one is our fault
15713 + $this->server_error(_('Remote profile with no matching profile'), 500);
15716 + $nickname = $req->get_parameter('omb_listenee_nickname');
15717 + if ($nickname && !Validate::string($nickname, array('min_length' => 1,
15718 + 'max_length' => 64,
15719 + 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
15720 + $this->client_error(_('Nickname must have only lowercase letters and numbers and no spaces.'));
15723 + $license = $req->get_parameter('omb_listenee_license');
15724 + if ($license && !common_valid_http_url($license)) {
15725 + $this->client_error(sprintf(_("Invalid license URL '%s'"), $license));
15728 + $profile_url = $req->get_parameter('omb_listenee_profile');
15729 + if ($profile_url && !common_valid_http_url($profile_url)) {
15730 + $this->client_error(sprintf(_("Invalid profile URL '%s'."), $profile_url));
15734 + $fullname = $req->get_parameter('omb_listenee_fullname');
15735 + if ($fullname && strlen($fullname) > 255) {
15736 + $this->client_error(_("Full name is too long (max 255 chars)."));
15739 + $homepage = $req->get_parameter('omb_listenee_homepage');
15740 + if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
15741 + $this->client_error(sprintf(_("Invalid homepage '%s'"), $homepage));
15744 + $bio = $req->get_parameter('omb_listenee_bio');
15745 + if ($bio && strlen($bio) > 140) {
15746 + $this->client_error(_("Bio is too long (max 140 chars)."));
15749 + $location = $req->get_parameter('omb_listenee_location');
15750 + if ($location && strlen($location) > 255) {
15751 + $this->client_error(_("Location is too long (max 255 chars)."));
15754 + $avatar = $req->get_parameter('omb_listenee_avatar');
15756 + if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
15757 + $this->client_error(sprintf(_("Invalid avatar URL '%s'"), $avatar));
15760 + $size = @getimagesize($avatar);
15762 + $this->client_error(sprintf(_("Can't read avatar URL '%s'"), $avatar));
15765 + if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
15766 + $this->client_error(sprintf(_("Wrong size image at '%s'"), $avatar));
15769 + if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
15770 + IMAGETYPE_PNG))) {
15771 + $this->client_error(sprintf(_("Wrong image type for '%s'"), $avatar));
15775 hunk ./actions/updateprofile.php 134
15776 - $orig_profile = clone($profile);
15777 + $orig_profile = clone($profile);
15778 hunk ./actions/updateprofile.php 136
15780 - $profile->nickname = $nickname;
15782 - if ($profile_url) {
15783 - $profile->profileurl = $profile_url;
15786 - $profile->fullname = $fullname;
15789 - $profile->homepage = $homepage;
15792 - $profile->bio = $bio;
15795 - $profile->location = $location;
15798 + $profile->nickname = $nickname;
15800 + if ($profile_url) {
15801 + $profile->profileurl = $profile_url;
15804 + $profile->fullname = $fullname;
15807 + $profile->homepage = $homepage;
15810 + $profile->bio = $bio;
15813 + $profile->location = $location;
15815 hunk ./actions/updateprofile.php 155
15816 - if (!$profile->update($orig_profile)) {
15817 - $this->server_error(_('Could not save new profile info'), 500);
15821 - $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
15822 - copy($avatar, $temp_filename);
15823 - if (!$profile->setOriginal($temp_filename)) {
15824 - $this->server_error(_('Could not save avatar info'), 500);
15828 - header('HTTP/1.1 200 OK');
15829 - header('Content-type: text/plain');
15830 - print 'Updated profile';
15835 + if (!$profile->update($orig_profile)) {
15836 + $this->server_error(_('Could not save new profile info'), 500);
15840 + $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
15841 + copy($avatar, $temp_filename);
15842 + if (!$profile->setOriginal($temp_filename)) {
15843 + $this->server_error(_('Could not save avatar info'), 500);
15847 + header('HTTP/1.1 200 OK');
15848 + header('Content-type: text/plain');
15849 + print 'Updated profile';
15854 hunk ./actions/userauthorization.php 27
15855 - function handle($args) {
15856 - parent::handle($args);
15857 + function handle($args) {
15858 + parent::handle($args);
15859 hunk ./actions/userauthorization.php 30
15860 - if ($_SERVER['REQUEST_METHOD'] == 'POST') {
15861 - # CSRF protection
15862 - $token = $this->trimmed('token');
15863 - if (!$token || $token != common_session_token()) {
15864 - $req = $this->get_stored_request();
15865 - $this->show_form(_('There was a problem with your session token. Try again, please.'), $req);
15868 - # We've shown the form, now post user's choice
15869 - $this->send_authorization();
15871 - if (!common_logged_in()) {
15872 - # Go log in, and then come back
15873 - common_debug('saving URL for returnto', __FILE__);
15874 - common_set_returnto($_SERVER['REQUEST_URI']);
15875 + if ($_SERVER['REQUEST_METHOD'] == 'POST') {
15876 + # CSRF protection
15877 + $token = $this->trimmed('token');
15878 + if (!$token || $token != common_session_token()) {
15879 + $req = $this->get_stored_request();
15880 + $this->show_form(_('There was a problem with your session token. Try again, please.'), $req);
15883 + # We've shown the form, now post user's choice
15884 + $this->send_authorization();
15886 + if (!common_logged_in()) {
15887 + # Go log in, and then come back
15888 + common_debug('saving URL for returnto', __FILE__);
15889 + common_set_returnto($_SERVER['REQUEST_URI']);
15890 hunk ./actions/userauthorization.php 46
15891 - common_debug('redirecting to login', __FILE__);
15892 - common_redirect(common_local_url('login'));
15896 - # this must be a new request
15897 - common_debug('getting new request', __FILE__);
15898 - $req = $this->get_new_request();
15900 - $this->client_error(_('No request found!'));
15902 - common_debug('validating request', __FILE__);
15903 - # XXX: only validate new requests, since nonce is one-time use
15904 - $this->validate_request($req);
15905 - common_debug('showing form', __FILE__);
15906 - $this->store_request($req);
15907 - $this->show_form($req);
15908 - } catch (OAuthException $e) {
15909 - $this->clear_request();
15910 - $this->client_error($e->getMessage());
15913 + common_debug('redirecting to login', __FILE__);
15914 + common_redirect(common_local_url('login'));
15918 + # this must be a new request
15919 + common_debug('getting new request', __FILE__);
15920 + $req = $this->get_new_request();
15922 + $this->client_error(_('No request found!'));
15924 + common_debug('validating request', __FILE__);
15925 + # XXX: only validate new requests, since nonce is one-time use
15926 + $this->validate_request($req);
15927 + common_debug('showing form', __FILE__);
15928 + $this->store_request($req);
15929 + $this->show_form($req);
15930 + } catch (OAuthException $e) {
15931 + $this->clear_request();
15932 + $this->client_error($e->getMessage());
15935 hunk ./actions/userauthorization.php 69
15940 hunk ./actions/userauthorization.php 72
15941 - function show_form($req) {
15942 + function show_form($req) {
15943 hunk ./actions/userauthorization.php 74
15944 - $nickname = $req->get_parameter('omb_listenee_nickname');
15945 - $profile = $req->get_parameter('omb_listenee_profile');
15946 - $license = $req->get_parameter('omb_listenee_license');
15947 - $fullname = $req->get_parameter('omb_listenee_fullname');
15948 - $homepage = $req->get_parameter('omb_listenee_homepage');
15949 - $bio = $req->get_parameter('omb_listenee_bio');
15950 - $location = $req->get_parameter('omb_listenee_location');
15951 - $avatar = $req->get_parameter('omb_listenee_avatar');
15952 + $nickname = $req->get_parameter('omb_listenee_nickname');
15953 + $profile = $req->get_parameter('omb_listenee_profile');
15954 + $license = $req->get_parameter('omb_listenee_license');
15955 + $fullname = $req->get_parameter('omb_listenee_fullname');
15956 + $homepage = $req->get_parameter('omb_listenee_homepage');
15957 + $bio = $req->get_parameter('omb_listenee_bio');
15958 + $location = $req->get_parameter('omb_listenee_location');
15959 + $avatar = $req->get_parameter('omb_listenee_avatar');
15960 hunk ./actions/userauthorization.php 83
15961 - common_show_header(_('Authorize subscription'));
15962 - common_element('p', NULL, _('Please check these details to make sure '.
15963 - 'that you want to subscribe to this user\'s notices. '.
15964 - 'If you didn\'t just ask to subscribe to someone\'s notices, '.
15965 - 'click "Cancel".'));
15966 - common_element_start('div', 'profile');
15968 - common_element('img', array('src' => $avatar,
15969 - 'class' => 'avatar profile',
15970 - 'width' => AVATAR_PROFILE_SIZE,
15971 - 'height' => AVATAR_PROFILE_SIZE,
15972 - 'alt' => $nickname));
15974 - common_element('a', array('href' => $profile,
15975 - 'class' => 'external profile nickname'),
15978 - common_element_start('div', 'fullname');
15980 - common_element('a', array('href' => $homepage),
15983 - common_text($fullname);
15985 - common_element_end('div');
15988 - common_element('div', 'location', $location);
15991 - common_element('div', 'bio', $bio);
15993 - common_element_start('div', 'license');
15994 - common_element('a', array('href' => $license,
15995 - 'class' => 'license'),
15997 - common_element_end('div');
15998 - common_element_end('div');
15999 - common_element_start('form', array('method' => 'post',
16000 - 'id' => 'userauthorization',
16001 - 'name' => 'userauthorization',
16002 - 'action' => common_local_url('userauthorization')));
16003 - common_hidden('token', common_session_token());
16004 - common_submit('accept', _('Accept'));
16005 - common_submit('reject', _('Reject'));
16006 - common_element_end('form');
16007 - common_show_footer();
16009 + common_show_header(_('Authorize subscription'));
16010 + common_element('p', NULL, _('Please check these details to make sure '.
16011 + 'that you want to subscribe to this user\'s notices. '.
16012 + 'If you didn\'t just ask to subscribe to someone\'s notices, '.
16013 + 'click "Cancel".'));
16014 + common_element_start('div', 'profile');
16016 + common_element('img', array('src' => $avatar,
16017 + 'class' => 'avatar profile',
16018 + 'width' => AVATAR_PROFILE_SIZE,
16019 + 'height' => AVATAR_PROFILE_SIZE,
16020 + 'alt' => $nickname));
16022 + common_element('a', array('href' => $profile,
16023 + 'class' => 'external profile nickname'),
16026 + common_element_start('div', 'fullname');
16028 + common_element('a', array('href' => $homepage),
16031 + common_text($fullname);
16033 + common_element_end('div');
16036 + common_element('div', 'location', $location);
16039 + common_element('div', 'bio', $bio);
16041 + common_element_start('div', 'license');
16042 + common_element('a', array('href' => $license,
16043 + 'class' => 'license'),
16045 + common_element_end('div');
16046 + common_element_end('div');
16047 + common_element_start('form', array('method' => 'post',
16048 + 'id' => 'userauthorization',
16049 + 'name' => 'userauthorization',
16050 + 'action' => common_local_url('userauthorization')));
16051 + common_hidden('token', common_session_token());
16052 + common_submit('accept', _('Accept'));
16053 + common_submit('reject', _('Reject'));
16054 + common_element_end('form');
16055 + common_show_footer();
16057 hunk ./actions/userauthorization.php 132
16058 - function send_authorization() {
16059 - $req = $this->get_stored_request();
16060 + function send_authorization() {
16061 + $req = $this->get_stored_request();
16062 hunk ./actions/userauthorization.php 135
16064 - common_user_error(_('No authorization request!'));
16068 + common_user_error(_('No authorization request!'));
16071 hunk ./actions/userauthorization.php 140
16072 - $callback = $req->get_parameter('oauth_callback');
16073 + $callback = $req->get_parameter('oauth_callback');
16074 hunk ./actions/userauthorization.php 142
16075 - if ($this->arg('accept')) {
16076 - if (!$this->authorize_token($req)) {
16077 - $this->client_error(_('Error authorizing token'));
16079 - if (!$this->save_remote_profile($req)) {
16080 - $this->client_error(_('Error saving remote profile'));
16082 - if (!$callback) {
16083 - $this->show_accept_message($req->get_parameter('oauth_token'));
16085 - $params = array();
16086 - $params['oauth_token'] = $req->get_parameter('oauth_token');
16087 - $params['omb_version'] = OMB_VERSION_01;
16088 - $user = User::staticGet('uri', $req->get_parameter('omb_listener'));
16089 - $profile = $user->getProfile();
16091 - common_log_db_error($user, 'SELECT', __FILE__);
16092 - $this->server_error(_('User without matching profile'));
16095 - $params['omb_listener_nickname'] = $user->nickname;
16096 - $params['omb_listener_profile'] = common_local_url('showstream',
16097 - array('nickname' => $user->nickname));
16098 - if ($profile->fullname) {
16099 - $params['omb_listener_fullname'] = $profile->fullname;
16101 - if ($profile->homepage) {
16102 - $params['omb_listener_homepage'] = $profile->homepage;
16104 - if ($profile->bio) {
16105 - $params['omb_listener_bio'] = $profile->bio;
16107 - if ($profile->location) {
16108 - $params['omb_listener_location'] = $profile->location;
16110 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
16112 - $params['omb_listener_avatar'] = $avatar->url;
16114 - $parts = array();
16115 - foreach ($params as $k => $v) {
16116 - $parts[] = $k . '=' . OAuthUtil::urlencodeRFC3986($v);
16118 - $query_string = implode('&', $parts);
16119 - $parsed = parse_url($callback);
16120 - $url = $callback . (($parsed['query']) ? '&' : '?') . $query_string;
16121 - common_redirect($url, 303);
16124 - if (!$callback) {
16125 - $this->show_reject_message();
16127 - # XXX: not 100% sure how to signal failure... just redirect without token?
16128 - common_redirect($callback, 303);
16132 + if ($this->arg('accept')) {
16133 + if (!$this->authorize_token($req)) {
16134 + $this->client_error(_('Error authorizing token'));
16136 + if (!$this->save_remote_profile($req)) {
16137 + $this->client_error(_('Error saving remote profile'));
16139 + if (!$callback) {
16140 + $this->show_accept_message($req->get_parameter('oauth_token'));
16142 + $params = array();
16143 + $params['oauth_token'] = $req->get_parameter('oauth_token');
16144 + $params['omb_version'] = OMB_VERSION_01;
16145 + $user = User::staticGet('uri', $req->get_parameter('omb_listener'));
16146 + $profile = $user->getProfile();
16148 + common_log_db_error($user, 'SELECT', __FILE__);
16149 + $this->server_error(_('User without matching profile'));
16152 + $params['omb_listener_nickname'] = $user->nickname;
16153 + $params['omb_listener_profile'] = common_local_url('showstream',
16154 + array('nickname' => $user->nickname));
16155 + if ($profile->fullname) {
16156 + $params['omb_listener_fullname'] = $profile->fullname;
16158 + if ($profile->homepage) {
16159 + $params['omb_listener_homepage'] = $profile->homepage;
16161 + if ($profile->bio) {
16162 + $params['omb_listener_bio'] = $profile->bio;
16164 + if ($profile->location) {
16165 + $params['omb_listener_location'] = $profile->location;
16167 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
16169 + $params['omb_listener_avatar'] = $avatar->url;
16171 + $parts = array();
16172 + foreach ($params as $k => $v) {
16173 + $parts[] = $k . '=' . OAuthUtil::urlencodeRFC3986($v);
16175 + $query_string = implode('&', $parts);
16176 + $parsed = parse_url($callback);
16177 + $url = $callback . (($parsed['query']) ? '&' : '?') . $query_string;
16178 + common_redirect($url, 303);
16181 + if (!$callback) {
16182 + $this->show_reject_message();
16184 + # XXX: not 100% sure how to signal failure... just redirect without token?
16185 + common_redirect($callback, 303);
16189 hunk ./actions/userauthorization.php 200
16190 - function authorize_token(&$req) {
16191 - $consumer_key = $req->get_parameter('oauth_consumer_key');
16192 - $token_field = $req->get_parameter('oauth_token');
16193 - common_debug('consumer key = "'.$consumer_key.'"', __FILE__);
16194 - common_debug('token field = "'.$token_field.'"', __FILE__);
16195 - $rt = new Token();
16196 - $rt->consumer_key = $consumer_key;
16197 - $rt->tok = $token_field;
16200 - common_debug('request token to look up: "'.print_r($rt,TRUE).'"');
16201 - if ($rt->find(true)) {
16202 - common_debug('found request token to authorize', __FILE__);
16203 - $orig_rt = clone($rt);
16204 - $rt->state = 1; # Authorized but not used
16205 - if ($rt->update($orig_rt)) {
16206 - common_debug('updated request token so it is authorized', __FILE__);
16212 + function authorize_token(&$req) {
16213 + $consumer_key = $req->get_parameter('oauth_consumer_key');
16214 + $token_field = $req->get_parameter('oauth_token');
16215 + common_debug('consumer key = "'.$consumer_key.'"', __FILE__);
16216 + common_debug('token field = "'.$token_field.'"', __FILE__);
16217 + $rt = new Token();
16218 + $rt->consumer_key = $consumer_key;
16219 + $rt->tok = $token_field;
16222 + common_debug('request token to look up: "'.print_r($rt,TRUE).'"');
16223 + if ($rt->find(true)) {
16224 + common_debug('found request token to authorize', __FILE__);
16225 + $orig_rt = clone($rt);
16226 + $rt->state = 1; # Authorized but not used
16227 + if ($rt->update($orig_rt)) {
16228 + common_debug('updated request token so it is authorized', __FILE__);
16234 hunk ./actions/userauthorization.php 223
16235 - # XXX: refactor with similar code in finishremotesubscribe.php
16236 + # XXX: refactor with similar code in finishremotesubscribe.php
16237 hunk ./actions/userauthorization.php 225
16238 - function save_remote_profile(&$req) {
16239 - # FIXME: we should really do this when the consumer comes
16240 - # back for an access token. If they never do, we've got stuff in a
16242 + function save_remote_profile(&$req) {
16243 + # FIXME: we should really do this when the consumer comes
16244 + # back for an access token. If they never do, we've got stuff in a
16246 hunk ./actions/userauthorization.php 230
16247 - $nickname = $req->get_parameter('omb_listenee_nickname');
16248 - $fullname = $req->get_parameter('omb_listenee_fullname');
16249 - $profile_url = $req->get_parameter('omb_listenee_profile');
16250 - $homepage = $req->get_parameter('omb_listenee_homepage');
16251 - $bio = $req->get_parameter('omb_listenee_bio');
16252 - $location = $req->get_parameter('omb_listenee_location');
16253 - $avatar_url = $req->get_parameter('omb_listenee_avatar');
16254 + $nickname = $req->get_parameter('omb_listenee_nickname');
16255 + $fullname = $req->get_parameter('omb_listenee_fullname');
16256 + $profile_url = $req->get_parameter('omb_listenee_profile');
16257 + $homepage = $req->get_parameter('omb_listenee_homepage');
16258 + $bio = $req->get_parameter('omb_listenee_bio');
16259 + $location = $req->get_parameter('omb_listenee_location');
16260 + $avatar_url = $req->get_parameter('omb_listenee_avatar');
16261 hunk ./actions/userauthorization.php 238
16262 - $listenee = $req->get_parameter('omb_listenee');
16263 - $remote = Remote_profile::staticGet('uri', $listenee);
16264 + $listenee = $req->get_parameter('omb_listenee');
16265 + $remote = Remote_profile::staticGet('uri', $listenee);
16266 hunk ./actions/userauthorization.php 241
16269 - $profile = Profile::staticGet($remote->id);
16270 - $orig_remote = clone($remote);
16271 - $orig_profile = clone($profile);
16274 - $remote = new Remote_profile();
16275 - $remote->uri = $listenee;
16276 - $profile = new Profile();
16280 + $profile = Profile::staticGet($remote->id);
16281 + $orig_remote = clone($remote);
16282 + $orig_profile = clone($profile);
16285 + $remote = new Remote_profile();
16286 + $remote->uri = $listenee;
16287 + $profile = new Profile();
16289 hunk ./actions/userauthorization.php 253
16290 - $profile->nickname = $nickname;
16291 - $profile->profileurl = $profile_url;
16292 + $profile->nickname = $nickname;
16293 + $profile->profileurl = $profile_url;
16294 hunk ./actions/userauthorization.php 256
16296 - $profile->fullname = $fullname;
16299 - $profile->homepage = $homepage;
16302 - $profile->bio = $bio;
16305 - $profile->location = $location;
16308 + $profile->fullname = $fullname;
16311 + $profile->homepage = $homepage;
16314 + $profile->bio = $bio;
16317 + $profile->location = $location;
16319 hunk ./actions/userauthorization.php 269
16321 - $profile->update($orig_profile);
16323 - $profile->created = DB_DataObject_Cast::dateTime(); # current time
16324 - $id = $profile->insert();
16328 - $remote->id = $id;
16331 + $profile->update($orig_profile);
16333 + $profile->created = DB_DataObject_Cast::dateTime(); # current time
16334 + $id = $profile->insert();
16338 + $remote->id = $id;
16340 hunk ./actions/userauthorization.php 280
16342 - if (!$remote->update($orig_remote)) {
16346 - $remote->created = DB_DataObject_Cast::dateTime(); # current time
16347 - if (!$remote->insert()) {
16352 + if (!$remote->update($orig_remote)) {
16356 + $remote->created = DB_DataObject_Cast::dateTime(); # current time
16357 + if (!$remote->insert()) {
16361 hunk ./actions/userauthorization.php 291
16362 - if ($avatar_url) {
16363 - if (!$this->add_avatar($profile, $avatar_url)) {
16367 + if ($avatar_url) {
16368 + if (!$this->add_avatar($profile, $avatar_url)) {
16372 hunk ./actions/userauthorization.php 297
16373 - $user = common_current_user();
16374 - $datastore = omb_oauth_datastore();
16375 - $consumer = $this->get_consumer($datastore, $req);
16376 - $token = $this->get_token($datastore, $req, $consumer);
16377 + $user = common_current_user();
16378 + $datastore = omb_oauth_datastore();
16379 + $consumer = $this->get_consumer($datastore, $req);
16380 + $token = $this->get_token($datastore, $req, $consumer);
16381 hunk ./actions/userauthorization.php 302
16382 - $sub = new Subscription();
16383 - $sub->subscriber = $user->id;
16384 - $sub->subscribed = $remote->id;
16385 - $sub->token = $token->key; # NOTE: request token, not valid for use!
16386 - $sub->created = DB_DataObject_Cast::dateTime(); # current time
16387 + $sub = new Subscription();
16388 + $sub->subscriber = $user->id;
16389 + $sub->subscribed = $remote->id;
16390 + $sub->token = $token->key; # NOTE: request token, not valid for use!
16391 + $sub->created = DB_DataObject_Cast::dateTime(); # current time
16392 hunk ./actions/userauthorization.php 308
16393 - if (!$sub->insert()) {
16396 + if (!$sub->insert()) {
16399 hunk ./actions/userauthorization.php 312
16404 hunk ./actions/userauthorization.php 315
16405 - function add_avatar($profile, $url) {
16406 - $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
16407 - copy($url, $temp_filename);
16408 - return $profile->setOriginal($temp_filename);
16410 + function add_avatar($profile, $url) {
16411 + $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
16412 + copy($url, $temp_filename);
16413 + return $profile->setOriginal($temp_filename);
16415 hunk ./actions/userauthorization.php 321
16416 - function show_accept_message($tok) {
16417 - common_show_header(_('Subscription authorized'));
16418 - common_element('p', NULL,
16419 - _('The subscription has been authorized, but no '.
16420 - 'callback URL was passed. Check with the site\'s instructions for '.
16421 - 'details on how to authorize the subscription. Your subscription token is:'));
16422 - common_element('blockquote', 'token', $tok);
16423 - common_show_footer();
16425 + function show_accept_message($tok) {
16426 + common_show_header(_('Subscription authorized'));
16427 + common_element('p', NULL,
16428 + _('The subscription has been authorized, but no '.
16429 + 'callback URL was passed. Check with the site\'s instructions for '.
16430 + 'details on how to authorize the subscription. Your subscription token is:'));
16431 + common_element('blockquote', 'token', $tok);
16432 + common_show_footer();
16434 hunk ./actions/userauthorization.php 331
16435 - function show_reject_message($tok) {
16436 - common_show_header(_('Subscription rejected'));
16437 - common_element('p', NULL,
16438 - _('The subscription has been rejected, but no '.
16439 - 'callback URL was passed. Check with the site\'s instructions for '.
16440 - 'details on how to fully reject the subscription.'));
16441 - common_show_footer();
16443 + function show_reject_message($tok) {
16444 + common_show_header(_('Subscription rejected'));
16445 + common_element('p', NULL,
16446 + _('The subscription has been rejected, but no '.
16447 + 'callback URL was passed. Check with the site\'s instructions for '.
16448 + 'details on how to fully reject the subscription.'));
16449 + common_show_footer();
16451 hunk ./actions/userauthorization.php 340
16452 - function store_request($req) {
16453 - common_ensure_session();
16454 - $_SESSION['userauthorizationrequest'] = $req;
16456 + function store_request($req) {
16457 + common_ensure_session();
16458 + $_SESSION['userauthorizationrequest'] = $req;
16460 hunk ./actions/userauthorization.php 345
16461 - function clear_request() {
16462 - common_ensure_session();
16463 - unset($_SESSION['userauthorizationrequest']);
16465 + function clear_request() {
16466 + common_ensure_session();
16467 + unset($_SESSION['userauthorizationrequest']);
16469 hunk ./actions/userauthorization.php 350
16470 - function get_stored_request() {
16471 - common_ensure_session();
16472 - $req = $_SESSION['userauthorizationrequest'];
16475 + function get_stored_request() {
16476 + common_ensure_session();
16477 + $req = $_SESSION['userauthorizationrequest'];
16480 hunk ./actions/userauthorization.php 356
16481 - function get_new_request() {
16482 - common_remove_magic_from_request();
16483 - $req = OAuthRequest::from_request();
16486 + function get_new_request() {
16487 + common_remove_magic_from_request();
16488 + $req = OAuthRequest::from_request();
16491 hunk ./actions/userauthorization.php 362
16492 - # Throws an OAuthException if anything goes wrong
16493 + # Throws an OAuthException if anything goes wrong
16494 hunk ./actions/userauthorization.php 364
16495 - function validate_request(&$req) {
16496 - # OAuth stuff -- have to copy from OAuth.php since they're
16497 - # all private methods, and there's no user-authentication method
16498 - common_debug('checking version', __FILE__);
16499 - $this->check_version($req);
16500 - common_debug('getting datastore', __FILE__);
16501 - $datastore = omb_oauth_datastore();
16502 - common_debug('getting consumer', __FILE__);
16503 - $consumer = $this->get_consumer($datastore, $req);
16504 - common_debug('getting token', __FILE__);
16505 - $token = $this->get_token($datastore, $req, $consumer);
16506 - common_debug('checking timestamp', __FILE__);
16507 - $this->check_timestamp($req);
16508 - common_debug('checking nonce', __FILE__);
16509 - $this->check_nonce($datastore, $req, $consumer, $token);
16510 - common_debug('checking signature', __FILE__);
16511 - $this->check_signature($req, $consumer, $token);
16512 - common_debug('validating omb stuff', __FILE__);
16513 - $this->validate_omb($req);
16514 - common_debug('done validating', __FILE__);
16517 + function validate_request(&$req) {
16518 + # OAuth stuff -- have to copy from OAuth.php since they're
16519 + # all private methods, and there's no user-authentication method
16520 + common_debug('checking version', __FILE__);
16521 + $this->check_version($req);
16522 + common_debug('getting datastore', __FILE__);
16523 + $datastore = omb_oauth_datastore();
16524 + common_debug('getting consumer', __FILE__);
16525 + $consumer = $this->get_consumer($datastore, $req);
16526 + common_debug('getting token', __FILE__);
16527 + $token = $this->get_token($datastore, $req, $consumer);
16528 + common_debug('checking timestamp', __FILE__);
16529 + $this->check_timestamp($req);
16530 + common_debug('checking nonce', __FILE__);
16531 + $this->check_nonce($datastore, $req, $consumer, $token);
16532 + common_debug('checking signature', __FILE__);
16533 + $this->check_signature($req, $consumer, $token);
16534 + common_debug('validating omb stuff', __FILE__);
16535 + $this->validate_omb($req);
16536 + common_debug('done validating', __FILE__);
16539 hunk ./actions/userauthorization.php 387
16540 - function validate_omb(&$req) {
16541 - foreach (array('omb_version', 'omb_listener', 'omb_listenee',
16542 - 'omb_listenee_profile', 'omb_listenee_nickname',
16543 - 'omb_listenee_license') as $param)
16545 - if (!$req->get_parameter($param)) {
16546 - throw new OAuthException("Required parameter '$param' not found");
16550 - $version = $req->get_parameter('omb_version');
16551 - if ($version != OMB_VERSION_01) {
16552 - throw new OAuthException("OpenMicroBlogging version '$version' not supported");
16554 - $listener = $req->get_parameter('omb_listener');
16555 - $user = User::staticGet('uri', $listener);
16557 - throw new OAuthException("Listener URI '$listener' not found here");
16559 - $cur = common_current_user();
16560 - if ($cur->id != $user->id) {
16561 - throw new OAuthException("Can't add for another user!");
16563 - $listenee = $req->get_parameter('omb_listenee');
16564 - if (!Validate::uri($listenee) &&
16565 - !common_valid_tag($listenee)) {
16566 - throw new OAuthException("Listenee URI '$listenee' not a recognizable URI");
16568 - if (strlen($listenee) > 255) {
16569 - throw new OAuthException("Listenee URI '$listenee' too long");
16571 + function validate_omb(&$req) {
16572 + foreach (array('omb_version', 'omb_listener', 'omb_listenee',
16573 + 'omb_listenee_profile', 'omb_listenee_nickname',
16574 + 'omb_listenee_license') as $param)
16576 + if (!$req->get_parameter($param)) {
16577 + throw new OAuthException("Required parameter '$param' not found");
16581 + $version = $req->get_parameter('omb_version');
16582 + if ($version != OMB_VERSION_01) {
16583 + throw new OAuthException("OpenMicroBlogging version '$version' not supported");
16585 + $listener = $req->get_parameter('omb_listener');
16586 + $user = User::staticGet('uri', $listener);
16588 + throw new OAuthException("Listener URI '$listener' not found here");
16590 + $cur = common_current_user();
16591 + if ($cur->id != $user->id) {
16592 + throw new OAuthException("Can't add for another user!");
16594 + $listenee = $req->get_parameter('omb_listenee');
16595 + if (!Validate::uri($listenee) &&
16596 + !common_valid_tag($listenee)) {
16597 + throw new OAuthException("Listenee URI '$listenee' not a recognizable URI");
16599 + if (strlen($listenee) > 255) {
16600 + throw new OAuthException("Listenee URI '$listenee' too long");
16602 hunk ./actions/userauthorization.php 419
16603 - $other = User::staticGet('uri', $listenee);
16605 - throw new OAuthException("Listenee URI '$listenee' is local user");
16607 + $other = User::staticGet('uri', $listenee);
16609 + throw new OAuthException("Listenee URI '$listenee' is local user");
16611 hunk ./actions/userauthorization.php 424
16612 - $remote = Remote_profile::staticGet('uri', $listenee);
16614 - $sub = new Subscription();
16615 - $sub->subscriber = $user->id;
16616 - $sub->subscribed = $remote->id;
16617 - if ($sub->find(TRUE)) {
16618 - throw new OAuthException("Already subscribed to user!");
16621 - $nickname = $req->get_parameter('omb_listenee_nickname');
16622 - if (!Validate::string($nickname, array('min_length' => 1,
16623 - 'max_length' => 64,
16624 - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
16625 - throw new OAuthException('Nickname must have only letters and numbers and no spaces.');
16627 - $profile = $req->get_parameter('omb_listenee_profile');
16628 - if (!common_valid_http_url($profile)) {
16629 - throw new OAuthException("Invalid profile URL '$profile'.");
16631 + $remote = Remote_profile::staticGet('uri', $listenee);
16633 + $sub = new Subscription();
16634 + $sub->subscriber = $user->id;
16635 + $sub->subscribed = $remote->id;
16636 + if ($sub->find(TRUE)) {
16637 + throw new OAuthException("Already subscribed to user!");
16640 + $nickname = $req->get_parameter('omb_listenee_nickname');
16641 + if (!Validate::string($nickname, array('min_length' => 1,
16642 + 'max_length' => 64,
16643 + 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
16644 + throw new OAuthException('Nickname must have only letters and numbers and no spaces.');
16646 + $profile = $req->get_parameter('omb_listenee_profile');
16647 + if (!common_valid_http_url($profile)) {
16648 + throw new OAuthException("Invalid profile URL '$profile'.");
16650 hunk ./actions/userauthorization.php 444
16651 - if ($profile == common_local_url('showstream', array('nickname' => $nickname))) {
16652 - throw new OAuthException("Profile URL '$profile' is for a local user.");
16654 + if ($profile == common_local_url('showstream', array('nickname' => $nickname))) {
16655 + throw new OAuthException("Profile URL '$profile' is for a local user.");
16657 hunk ./actions/userauthorization.php 448
16658 - $license = $req->get_parameter('omb_listenee_license');
16659 - if (!common_valid_http_url($license)) {
16660 - throw new OAuthException("Invalid license URL '$license'.");
16662 - $site_license = common_config('license', 'url');
16663 - if (!common_compatible_license($license, $site_license)) {
16664 - throw new OAuthException("Listenee stream license '$license' not compatible with site license '$site_license'.");
16667 - $fullname = $req->get_parameter('omb_listenee_fullname');
16668 - if ($fullname && strlen($fullname) > 255) {
16669 - throw new OAuthException("Full name '$fullname' too long.");
16671 - $homepage = $req->get_parameter('omb_listenee_homepage');
16672 - if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
16673 - throw new OAuthException("Invalid homepage '$homepage'");
16675 - $bio = $req->get_parameter('omb_listenee_bio');
16676 - if ($bio && strlen($bio) > 140) {
16677 - throw new OAuthException("Bio too long '$bio'");
16679 - $location = $req->get_parameter('omb_listenee_location');
16680 - if ($location && strlen($location) > 255) {
16681 - throw new OAuthException("Location too long '$location'");
16683 - $avatar = $req->get_parameter('omb_listenee_avatar');
16685 - if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
16686 - throw new OAuthException("Invalid avatar URL '$avatar'");
16688 - $size = @getimagesize($avatar);
16690 - throw new OAuthException("Can't read avatar URL '$avatar'");
16692 - if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
16693 - throw new OAuthException("Wrong size image at '$avatar'");
16695 - if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
16696 - IMAGETYPE_PNG))) {
16697 - throw new OAuthException("Wrong image type for '$avatar'");
16700 - $callback = $req->get_parameter('oauth_callback');
16701 - if ($callback && !common_valid_http_url($callback)) {
16702 - throw new OAuthException("Invalid callback URL '$callback'");
16704 - if ($callback && $callback == common_local_url('finishremotesubscribe')) {
16705 - throw new OAuthException("Callback URL '$callback' is for local site.");
16708 + $license = $req->get_parameter('omb_listenee_license');
16709 + if (!common_valid_http_url($license)) {
16710 + throw new OAuthException("Invalid license URL '$license'.");
16712 + $site_license = common_config('license', 'url');
16713 + if (!common_compatible_license($license, $site_license)) {
16714 + throw new OAuthException("Listenee stream license '$license' not compatible with site license '$site_license'.");
16717 + $fullname = $req->get_parameter('omb_listenee_fullname');
16718 + if ($fullname && strlen($fullname) > 255) {
16719 + throw new OAuthException("Full name '$fullname' too long.");
16721 + $homepage = $req->get_parameter('omb_listenee_homepage');
16722 + if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
16723 + throw new OAuthException("Invalid homepage '$homepage'");
16725 + $bio = $req->get_parameter('omb_listenee_bio');
16726 + if ($bio && strlen($bio) > 140) {
16727 + throw new OAuthException("Bio too long '$bio'");
16729 + $location = $req->get_parameter('omb_listenee_location');
16730 + if ($location && strlen($location) > 255) {
16731 + throw new OAuthException("Location too long '$location'");
16733 + $avatar = $req->get_parameter('omb_listenee_avatar');
16735 + if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
16736 + throw new OAuthException("Invalid avatar URL '$avatar'");
16738 + $size = @getimagesize($avatar);
16740 + throw new OAuthException("Can't read avatar URL '$avatar'");
16742 + if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
16743 + throw new OAuthException("Wrong size image at '$avatar'");
16745 + if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
16746 + IMAGETYPE_PNG))) {
16747 + throw new OAuthException("Wrong image type for '$avatar'");
16750 + $callback = $req->get_parameter('oauth_callback');
16751 + if ($callback && !common_valid_http_url($callback)) {
16752 + throw new OAuthException("Invalid callback URL '$callback'");
16754 + if ($callback && $callback == common_local_url('finishremotesubscribe')) {
16755 + throw new OAuthException("Callback URL '$callback' is for local site.");
16758 hunk ./actions/userauthorization.php 499
16759 - # Snagged from OAuthServer
16760 + # Snagged from OAuthServer
16761 hunk ./actions/userauthorization.php 501
16762 - function check_version(&$req) {
16763 - $version = $req->get_parameter("oauth_version");
16767 - if ($version != 1.0) {
16768 - throw new OAuthException("OAuth version '$version' not supported");
16772 + function check_version(&$req) {
16773 + $version = $req->get_parameter("oauth_version");
16777 + if ($version != 1.0) {
16778 + throw new OAuthException("OAuth version '$version' not supported");
16782 hunk ./actions/userauthorization.php 512
16783 - # Snagged from OAuthServer
16784 + # Snagged from OAuthServer
16785 hunk ./actions/userauthorization.php 514
16786 - function get_consumer($datastore, $req) {
16787 - $consumer_key = @$req->get_parameter("oauth_consumer_key");
16788 - if (!$consumer_key) {
16789 - throw new OAuthException("Invalid consumer key");
16791 + function get_consumer($datastore, $req) {
16792 + $consumer_key = @$req->get_parameter("oauth_consumer_key");
16793 + if (!$consumer_key) {
16794 + throw new OAuthException("Invalid consumer key");
16796 hunk ./actions/userauthorization.php 520
16797 - $consumer = $datastore->lookup_consumer($consumer_key);
16798 - if (!$consumer) {
16799 - throw new OAuthException("Invalid consumer");
16801 - return $consumer;
16803 + $consumer = $datastore->lookup_consumer($consumer_key);
16804 + if (!$consumer) {
16805 + throw new OAuthException("Invalid consumer");
16807 + return $consumer;
16809 hunk ./actions/userauthorization.php 527
16810 - # Mostly cadged from OAuthServer
16811 + # Mostly cadged from OAuthServer
16812 hunk ./actions/userauthorization.php 529
16813 - function get_token($datastore, &$req, $consumer) {/*{{{*/
16814 - $token_field = @$req->get_parameter('oauth_token');
16815 - $token = $datastore->lookup_token($consumer, 'request', $token_field);
16817 - throw new OAuthException("Invalid $token_type token: $token_field");
16821 + function get_token($datastore, &$req, $consumer) {/*{{{*/
16822 + $token_field = @$req->get_parameter('oauth_token');
16823 + $token = $datastore->lookup_token($consumer, 'request', $token_field);
16825 + throw new OAuthException("Invalid $token_type token: $token_field");
16829 hunk ./actions/userauthorization.php 538
16830 - function check_timestamp(&$req) {
16831 - $timestamp = @$req->get_parameter('oauth_timestamp');
16833 - if ($now - $timestamp > TIMESTAMP_THRESHOLD) {
16834 - throw new OAuthException("Expired timestamp, yours $timestamp, ours $now");
16837 + function check_timestamp(&$req) {
16838 + $timestamp = @$req->get_parameter('oauth_timestamp');
16840 + if ($now - $timestamp > TIMESTAMP_THRESHOLD) {
16841 + throw new OAuthException("Expired timestamp, yours $timestamp, ours $now");
16844 hunk ./actions/userauthorization.php 546
16845 - # NOTE: don't call twice on the same request; will fail!
16846 - function check_nonce(&$datastore, &$req, $consumer, $token) {
16847 - $timestamp = @$req->get_parameter('oauth_timestamp');
16848 - $nonce = @$req->get_parameter('oauth_nonce');
16849 - $found = $datastore->lookup_nonce($consumer, $token, $nonce, $timestamp);
16851 - throw new OAuthException("Nonce already used");
16855 + # NOTE: don't call twice on the same request; will fail!
16856 + function check_nonce(&$datastore, &$req, $consumer, $token) {
16857 + $timestamp = @$req->get_parameter('oauth_timestamp');
16858 + $nonce = @$req->get_parameter('oauth_nonce');
16859 + $found = $datastore->lookup_nonce($consumer, $token, $nonce, $timestamp);
16861 + throw new OAuthException("Nonce already used");
16865 hunk ./actions/userauthorization.php 557
16866 - function check_signature(&$req, $consumer, $token) {
16867 - $signature_method = $this->get_signature_method($req);
16868 - $signature = $req->get_parameter('oauth_signature');
16869 - $valid_sig = $signature_method->check_signature($req,
16873 - if (!$valid_sig) {
16874 - throw new OAuthException("Invalid signature");
16877 + function check_signature(&$req, $consumer, $token) {
16878 + $signature_method = $this->get_signature_method($req);
16879 + $signature = $req->get_parameter('oauth_signature');
16880 + $valid_sig = $signature_method->check_signature($req,
16884 + if (!$valid_sig) {
16885 + throw new OAuthException("Invalid signature");
16888 hunk ./actions/userauthorization.php 569
16889 - function get_signature_method(&$req) {
16890 - $signature_method = @$req->get_parameter("oauth_signature_method");
16891 - if (!$signature_method) {
16892 - $signature_method = "PLAINTEXT";
16894 - if ($signature_method != 'HMAC-SHA1') {
16895 - throw new OAuthException("Signature method '$signature_method' not supported.");
16897 - return omb_hmac_sha1();
16899 + function get_signature_method(&$req) {
16900 + $signature_method = @$req->get_parameter("oauth_signature_method");
16901 + if (!$signature_method) {
16902 + $signature_method = "PLAINTEXT";
16904 + if ($signature_method != 'HMAC-SHA1') {
16905 + throw new OAuthException("Signature method '$signature_method' not supported.");
16907 + return omb_hmac_sha1();
16909 hunk ./actions/userbyid.php 23
16911 - function is_readonly() {
16916 + function is_readonly() {
16920 hunk ./actions/userbyid.php 32
16921 - $this->client_error(_('No id.'));
16923 - $user =& User::staticGet($id);
16925 - $this->client_error(_('No such user.'));
16926 + $this->client_error(_('No id.'));
16928 + $user =& User::staticGet($id);
16930 + $this->client_error(_('No such user.'));
16931 hunk ./actions/userbyid.php 42
16932 - $type = common_negotiate_type(common_accept_to_prefs($httpaccept),
16933 + $type = common_negotiate_type(common_accept_to_prefs($httpaccept),
16934 hunk ./actions/userbyid.php 44
16935 - $page = $type == 'application/rdf+xml' ? 'foaf' : 'showstream';
16936 + $page = $type == 'application/rdf+xml' ? 'foaf' : 'showstream';
16937 hunk ./actions/userbyid.php 46
16938 - $url = common_local_url($page, array('nickname' => $user->nickname));
16939 - common_redirect($url, 303);
16941 + $url = common_local_url($page, array('nickname' => $user->nickname));
16942 + common_redirect($url, 303);
16944 hunk ./actions/userrss.php 28
16945 - var $user = NULL;
16946 + var $user = NULL;
16947 hunk ./actions/userrss.php 30
16948 - function init() {
16949 - $nickname = $this->trimmed('nickname');
16950 - $this->user = User::staticGet('nickname', $nickname);
16951 + function init() {
16952 + $nickname = $this->trimmed('nickname');
16953 + $this->user = User::staticGet('nickname', $nickname);
16954 hunk ./actions/userrss.php 34
16955 - if (!$this->user) {
16956 - common_user_error(_('No such user.'));
16962 + if (!$this->user) {
16963 + common_user_error(_('No such user.'));
16969 hunk ./actions/userrss.php 42
16970 - function get_notices($limit=0) {
16971 + function get_notices($limit=0) {
16972 hunk ./actions/userrss.php 44
16973 - $user = $this->user;
16975 - if (is_null($user)) {
16979 - $notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
16981 - while ($notice->fetch()) {
16982 - $notices[] = clone($notice);
16984 + $user = $this->user;
16986 + if (is_null($user)) {
16990 + $notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
16992 + while ($notice->fetch()) {
16993 + $notices[] = clone($notice);
16995 hunk ./actions/userrss.php 56
17000 hunk ./actions/userrss.php 59
17001 - function get_channel() {
17002 - $user = $this->user;
17003 - $profile = $user->getProfile();
17004 - $c = array('url' => common_local_url('userrss',
17005 - array('nickname' =>
17006 - $user->nickname)),
17007 - 'title' => $user->nickname,
17008 - 'link' => $profile->profileurl,
17009 - 'description' => sprintf(_('Microblog by %s'), $user->nickname));
17012 + function get_channel() {
17013 + $user = $this->user;
17014 + $profile = $user->getProfile();
17015 + $c = array('url' => common_local_url('userrss',
17016 + array('nickname' =>
17017 + $user->nickname)),
17018 + 'title' => $user->nickname,
17019 + 'link' => $profile->profileurl,
17020 + 'description' => sprintf(_('Microblog by %s'), $user->nickname));
17023 hunk ./actions/userrss.php 71
17024 - function get_image() {
17025 - $user = $this->user;
17026 - $profile = $user->getProfile();
17028 - common_log_db_error($user, 'SELECT', __FILE__);
17029 - $this->server_error(_('User without matching profile'));
17032 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
17033 - return ($avatar) ? $avatar->url : NULL;
17035 + function get_image() {
17036 + $user = $this->user;
17037 + $profile = $user->getProfile();
17039 + common_log_db_error($user, 'SELECT', __FILE__);
17040 + $this->server_error(_('User without matching profile'));
17043 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
17044 + return ($avatar) ? $avatar->url : NULL;
17046 hunk ./actions/userrss.php 83
17047 - # override parent to add X-SUP-ID URL
17049 - function init_rss($limit=0) {
17050 - $url = common_local_url('sup', NULL, $this->user->id);
17051 - header('X-SUP-ID: '.$url);
17052 - parent::init_rss($limit);
17054 + # override parent to add X-SUP-ID URL
17056 + function init_rss($limit=0) {
17057 + $url = common_local_url('sup', NULL, $this->user->id);
17058 + header('X-SUP-ID: '.$url);
17059 + parent::init_rss($limit);
17061 hunk ./actions/xrds.php 26
17062 - function is_readonly() {
17065 + function is_readonly() {
17068 hunk ./actions/xrds.php 30
17069 - function handle($args) {
17070 - parent::handle($args);
17071 - $nickname = $this->trimmed('nickname');
17072 - $user = User::staticGet('nickname', $nickname);
17074 - common_user_error(_('No such user.'));
17077 - $this->show_xrds($user);
17079 + function handle($args) {
17080 + parent::handle($args);
17081 + $nickname = $this->trimmed('nickname');
17082 + $user = User::staticGet('nickname', $nickname);
17084 + common_user_error(_('No such user.'));
17087 + $this->show_xrds($user);
17089 hunk ./actions/xrds.php 41
17090 - function show_xrds($user) {
17091 + function show_xrds($user) {
17092 hunk ./actions/xrds.php 43
17093 - header('Content-Type: application/xrds+xml');
17094 + header('Content-Type: application/xrds+xml');
17095 hunk ./actions/xrds.php 45
17096 - common_start_xml();
17097 - common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
17098 + common_start_xml();
17099 + common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
17100 hunk ./actions/xrds.php 48
17101 - common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
17102 - 'xml:id' => 'oauth',
17103 - 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
17104 - 'version' => '2.0'));
17105 + common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
17106 + 'xml:id' => 'oauth',
17107 + 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
17108 + 'version' => '2.0'));
17109 hunk ./actions/xrds.php 53
17110 - common_element('Type', NULL, 'xri://$xrds*simple');
17111 + common_element('Type', NULL, 'xri://$xrds*simple');
17112 hunk ./actions/xrds.php 55
17113 - $this->show_service(OAUTH_ENDPOINT_REQUEST,
17114 - common_local_url('requesttoken'),
17115 - array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
17116 - array(OAUTH_HMAC_SHA1),
17118 + $this->show_service(OAUTH_ENDPOINT_REQUEST,
17119 + common_local_url('requesttoken'),
17120 + array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
17121 + array(OAUTH_HMAC_SHA1),
17123 hunk ./actions/xrds.php 61
17124 - $this->show_service(OAUTH_ENDPOINT_AUTHORIZE,
17125 - common_local_url('userauthorization'),
17126 - array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
17127 - array(OAUTH_HMAC_SHA1));
17128 + $this->show_service(OAUTH_ENDPOINT_AUTHORIZE,
17129 + common_local_url('userauthorization'),
17130 + array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
17131 + array(OAUTH_HMAC_SHA1));
17132 hunk ./actions/xrds.php 66
17133 - $this->show_service(OAUTH_ENDPOINT_ACCESS,
17134 - common_local_url('accesstoken'),
17135 - array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
17136 - array(OAUTH_HMAC_SHA1));
17137 + $this->show_service(OAUTH_ENDPOINT_ACCESS,
17138 + common_local_url('accesstoken'),
17139 + array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
17140 + array(OAUTH_HMAC_SHA1));
17141 hunk ./actions/xrds.php 71
17142 - $this->show_service(OAUTH_ENDPOINT_RESOURCE,
17144 - array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
17145 - array(OAUTH_HMAC_SHA1));
17146 + $this->show_service(OAUTH_ENDPOINT_RESOURCE,
17148 + array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
17149 + array(OAUTH_HMAC_SHA1));
17150 hunk ./actions/xrds.php 76
17151 - common_element_end('XRD');
17152 + common_element_end('XRD');
17153 hunk ./actions/xrds.php 78
17154 - # XXX: decide whether to include user's ID/nickname in postNotice URL
17155 + # XXX: decide whether to include user's ID/nickname in postNotice URL
17156 hunk ./actions/xrds.php 80
17157 - common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
17158 - 'xml:id' => 'omb',
17159 - 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
17160 - 'version' => '2.0'));
17161 + common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
17162 + 'xml:id' => 'omb',
17163 + 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
17164 + 'version' => '2.0'));
17165 hunk ./actions/xrds.php 85
17166 - common_element('Type', NULL, 'xri://$xrds*simple');
17167 + common_element('Type', NULL, 'xri://$xrds*simple');
17168 hunk ./actions/xrds.php 87
17169 - $this->show_service(OMB_ENDPOINT_POSTNOTICE,
17170 - common_local_url('postnotice'));
17171 + $this->show_service(OMB_ENDPOINT_POSTNOTICE,
17172 + common_local_url('postnotice'));
17173 hunk ./actions/xrds.php 90
17174 - $this->show_service(OMB_ENDPOINT_UPDATEPROFILE,
17175 - common_local_url('updateprofile'));
17176 + $this->show_service(OMB_ENDPOINT_UPDATEPROFILE,
17177 + common_local_url('updateprofile'));
17178 hunk ./actions/xrds.php 93
17179 - common_element_end('XRD');
17180 + common_element_end('XRD');
17181 hunk ./actions/xrds.php 95
17182 - common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
17183 - 'version' => '2.0'));
17184 + common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
17185 + 'version' => '2.0'));
17186 hunk ./actions/xrds.php 98
17187 - common_element('Type', NULL, 'xri://$xrds*simple');
17188 + common_element('Type', NULL, 'xri://$xrds*simple');
17189 hunk ./actions/xrds.php 100
17190 - $this->show_service(OAUTH_DISCOVERY,
17192 - $this->show_service(OMB_NAMESPACE,
17194 + $this->show_service(OAUTH_DISCOVERY,
17196 + $this->show_service(OMB_NAMESPACE,
17198 hunk ./actions/xrds.php 105
17199 - common_element_end('XRD');
17200 + common_element_end('XRD');
17201 hunk ./actions/xrds.php 107
17202 - common_element_end('XRDS');
17203 - common_end_xml();
17205 + common_element_end('XRDS');
17206 + common_end_xml();
17208 hunk ./actions/xrds.php 111
17209 - function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
17210 - common_element_start('Service');
17212 - common_element('URI', NULL, $uri);
17214 - common_element('Type', NULL, $type);
17216 - foreach ($params as $param) {
17217 - common_element('Type', NULL, $param);
17221 - foreach ($sigs as $sig) {
17222 - common_element('Type', NULL, $sig);
17226 - common_element('LocalID', NULL, $localId);
17228 - common_element_end('Service');
17230 + function show_service($type, $uri, $params=NULL, $sigs=NULL, $localId=NULL) {
17231 + common_element_start('Service');
17233 + common_element('URI', NULL, $uri);
17235 + common_element('Type', NULL, $type);
17237 + foreach ($params as $param) {
17238 + common_element('Type', NULL, $param);
17242 + foreach ($sigs as $sig) {
17243 + common_element('Type', NULL, $sig);
17247 + common_element('LocalID', NULL, $localId);
17249 + common_element_end('Service');
17251 hunk ./classes/Avatar.php 29
17252 - # We clean up the file, too
17253 + # We clean up the file, too
17254 hunk ./classes/Avatar.php 31
17255 - function delete() {
17256 - $filename = $this->filename;
17257 - if (parent::delete()) {
17258 - @unlink(common_avatar_path($filename));
17261 + function delete() {
17262 + $filename = $this->filename;
17263 + if (parent::delete()) {
17264 + @unlink(common_avatar_path($filename));
17267 hunk ./classes/Avatar.php 38
17268 - # Create and save scaled version of this avatar
17269 - # XXX: maybe break into different methods
17270 + # Create and save scaled version of this avatar
17271 + # XXX: maybe break into different methods
17272 hunk ./classes/Avatar.php 41
17273 - function scale($size) {
17274 + function scale($size) {
17275 hunk ./classes/Avatar.php 43
17276 - $image_s = imagecreatetruecolor($size, $size);
17277 - $image_a = $this->to_image();
17278 - $square = min($this->width, $this->height);
17279 + $image_s = imagecreatetruecolor($size, $size);
17280 + $image_a = $this->to_image();
17281 + $square = min($this->width, $this->height);
17282 hunk ./classes/Avatar.php 49
17283 - imagecopyresampled($image_s, $image_a, 0, 0, 0, 0,
17284 - $size, $size, $square, $square);
17285 + imagecopyresampled($image_s, $image_a, 0, 0, 0, 0,
17286 + $size, $size, $square, $square);
17287 hunk ./classes/Avatar.php 52
17288 - $ext = ($this->mediattype == 'image/jpeg') ? ".jpeg" : ".png";
17289 + $ext = ($this->mediattype == 'image/jpeg') ? ".jpeg" : ".png";
17290 hunk ./classes/Avatar.php 54
17291 - $filename = common_avatar_filename($this->profile_id, $ext, $size, common_timestamp());
17292 + $filename = common_avatar_filename($this->profile_id, $ext, $size, common_timestamp());
17293 hunk ./classes/Avatar.php 56
17294 - if ($this->mediatype == 'image/jpeg') {
17295 - imagejpeg($image_s, common_avatar_path($filename));
17297 - imagepng($image_s, common_avatar_path($filename));
17299 + if ($this->mediatype == 'image/jpeg') {
17300 + imagejpeg($image_s, common_avatar_path($filename));
17302 + imagepng($image_s, common_avatar_path($filename));
17304 hunk ./classes/Avatar.php 62
17305 - $scaled = DB_DataObject::factory('avatar');
17306 - $scaled->profile_id = $this->profile_id;
17307 - $scaled->width = $size;
17308 - $scaled->height = $size;
17309 - $scaled->original = false;
17310 - $scaled->mediatype = ($this->mediattype == 'image/jpeg') ? 'image/jpeg' : 'image/png';
17311 - $scaled->filename = $filename;
17312 - $scaled->url = common_avatar_url($filename);
17313 - $scaled->created = DB_DataObject_Cast::dateTime(); # current time
17314 + $scaled = DB_DataObject::factory('avatar');
17315 + $scaled->profile_id = $this->profile_id;
17316 + $scaled->width = $size;
17317 + $scaled->height = $size;
17318 + $scaled->original = false;
17319 + $scaled->mediatype = ($this->mediattype == 'image/jpeg') ? 'image/jpeg' : 'image/png';
17320 + $scaled->filename = $filename;
17321 + $scaled->url = common_avatar_url($filename);
17322 + $scaled->created = DB_DataObject_Cast::dateTime(); # current time
17323 hunk ./classes/Avatar.php 72
17324 - if ($scaled->insert()) {
17330 + if ($scaled->insert()) {
17336 hunk ./classes/Avatar.php 79
17337 - function to_image() {
17338 - $filepath = common_avatar_path($this->filename);
17339 - if ($this->mediatype == 'image/gif') {
17340 - return imagecreatefromgif($filepath);
17341 - } else if ($this->mediatype == 'image/jpeg') {
17342 - return imagecreatefromjpeg($filepath);
17343 - } else if ($this->mediatype == 'image/png') {
17344 - return imagecreatefrompng($filepath);
17350 - function &pkeyGet($kv) {
17351 - return Memcached_DataObject::pkeyGet('Avatar', $kv);
17353 + function to_image() {
17354 + $filepath = common_avatar_path($this->filename);
17355 + if ($this->mediatype == 'image/gif') {
17356 + return imagecreatefromgif($filepath);
17357 + } else if ($this->mediatype == 'image/jpeg') {
17358 + return imagecreatefromjpeg($filepath);
17359 + } else if ($this->mediatype == 'image/png') {
17360 + return imagecreatefrompng($filepath);
17366 + function &pkeyGet($kv) {
17367 + return Memcached_DataObject::pkeyGet('Avatar', $kv);
17369 hunk ./classes/Channel.php 23
17371 - function on($user) {
17375 + function on($user) {
17378 hunk ./classes/Channel.php 28
17379 - function off($user) {
17382 + function off($user) {
17385 hunk ./classes/Channel.php 32
17386 - function output($user, $text) {
17390 - function error($user, $text) {
17394 - function source() {
17397 + function output($user, $text) {
17401 + function error($user, $text) {
17405 + function source() {
17408 hunk ./classes/Channel.php 47
17409 - var $conn = NULL;
17411 - function source() {
17415 - function __construct($conn) {
17416 - $this->conn = $conn;
17419 - function on($user) {
17420 - return $this->set_notify($user, 1);
17423 - function off($user) {
17424 - return $this->set_notify($user, 0);
17426 + var $conn = NULL;
17428 + function source() {
17432 + function __construct($conn) {
17433 + $this->conn = $conn;
17436 + function on($user) {
17437 + return $this->set_notify($user, 1);
17440 + function off($user) {
17441 + return $this->set_notify($user, 0);
17443 hunk ./classes/Channel.php 65
17444 - function output($user, $text) {
17445 - $text = '['.common_config('site', 'name') . '] ' . $text;
17446 - jabber_send_message($user->jabber, $text);
17449 - function error($user, $text) {
17450 - $text = '['.common_config('site', 'name') . '] ' . $text;
17451 - jabber_send_message($user->jabber, $text);
17454 - function set_notify(&$user, $notify) {
17455 - $orig = clone($user);
17456 - $user->jabbernotify = $notify;
17457 - $result = $user->update($orig);
17459 - $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
17460 - common_log(LOG_ERR,
17461 - 'Could not set notify flag to ' . $notify .
17462 - ' for user ' . common_log_objstring($user) .
17463 - ': ' . $last_error->message);
17466 - common_log(LOG_INFO,
17467 - 'User ' . $user->nickname . ' set notify flag to ' . $notify);
17471 + function output($user, $text) {
17472 + $text = '['.common_config('site', 'name') . '] ' . $text;
17473 + jabber_send_message($user->jabber, $text);
17476 + function error($user, $text) {
17477 + $text = '['.common_config('site', 'name') . '] ' . $text;
17478 + jabber_send_message($user->jabber, $text);
17481 + function set_notify(&$user, $notify) {
17482 + $orig = clone($user);
17483 + $user->jabbernotify = $notify;
17484 + $result = $user->update($orig);
17486 + $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
17487 + common_log(LOG_ERR,
17488 + 'Could not set notify flag to ' . $notify .
17489 + ' for user ' . common_log_objstring($user) .
17490 + ': ' . $last_error->message);
17493 + common_log(LOG_INFO,
17494 + 'User ' . $user->nickname . ' set notify flag to ' . $notify);
17498 hunk ./classes/Channel.php 97
17499 - function source() {
17503 - function on($user) {
17507 - function off($user) {
17510 + function source() {
17514 + function on($user) {
17518 + function off($user) {
17521 hunk ./classes/Channel.php 109
17522 - function output($user, $text) {
17523 - # XXX: buffer all output and send it at the end
17524 - # XXX: even better, redirect to appropriate page
17525 - # depending on what command was run
17526 - common_show_header(_('Command results'));
17527 - common_element('p', NULL, $text);
17528 - common_show_footer();
17531 - function error($user, $text) {
17532 - common_user_error($text);
17534 + function output($user, $text) {
17535 + # XXX: buffer all output and send it at the end
17536 + # XXX: even better, redirect to appropriate page
17537 + # depending on what command was run
17538 + common_show_header(_('Command results'));
17539 + common_element('p', NULL, $text);
17540 + common_show_footer();
17543 + function error($user, $text) {
17544 + common_user_error($text);
17546 hunk ./classes/Channel.php 126
17547 - function output($user, $text) {
17548 - common_start_html('text/xml;charset=utf-8', true);
17549 - common_element_start('head');
17550 - common_element('title', null, _('Command results'));
17551 - common_element_end('head');
17552 - common_element_start('body');
17553 - common_element('p', array('id' => 'command_result'), $text);
17554 - common_element_end('body');
17555 - common_element_end('html');
17557 + function output($user, $text) {
17558 + common_start_html('text/xml;charset=utf-8', true);
17559 + common_element_start('head');
17560 + common_element('title', null, _('Command results'));
17561 + common_element_end('head');
17562 + common_element_start('body');
17563 + common_element('p', array('id' => 'command_result'), $text);
17564 + common_element_end('body');
17565 + common_element_end('html');
17567 hunk ./classes/Channel.php 137
17568 - function error($user, $text) {
17569 - common_start_html('text/xml;charset=utf-8', true);
17570 - common_element_start('head');
17571 - common_element('title', null, _('Ajax Error'));
17572 - common_element_end('head');
17573 - common_element_start('body');
17574 - common_element('p', array('id' => 'error'), $text);
17575 - common_element_end('body');
17576 - common_element_end('html');
17578 + function error($user, $text) {
17579 + common_start_html('text/xml;charset=utf-8', true);
17580 + common_element_start('head');
17581 + common_element('title', null, _('Ajax Error'));
17582 + common_element_end('head');
17583 + common_element_start('body');
17584 + common_element('p', array('id' => 'error'), $text);
17585 + common_element_end('body');
17586 + common_element_end('html');
17588 hunk ./classes/Channel.php 152
17589 - var $addr = NULL;
17590 + var $addr = NULL;
17591 hunk ./classes/Channel.php 154
17592 - function source() {
17596 - function __construct($addr=NULL) {
17597 - $this->addr = $addr;
17600 - function on($user) {
17601 - return $this->set_notify($user, 1);
17604 - function off($user) {
17605 - return $this->set_notify($user, 0);
17607 + function source() {
17611 + function __construct($addr=NULL) {
17612 + $this->addr = $addr;
17615 + function on($user) {
17616 + return $this->set_notify($user, 1);
17619 + function off($user) {
17620 + return $this->set_notify($user, 0);
17622 hunk ./classes/Channel.php 170
17623 - function output($user, $text) {
17624 + function output($user, $text) {
17625 hunk ./classes/Channel.php 172
17626 - $headers['From'] = $user->incomingemail;
17627 - $headers['To'] = $this->addr;
17629 - $headers['Subject'] = _('Command complete');
17630 + $headers['From'] = $user->incomingemail;
17631 + $headers['To'] = $this->addr;
17633 + $headers['Subject'] = _('Command complete');
17634 hunk ./classes/Channel.php 177
17635 - return mail_send(array($this->addr), $headers, $text);
17638 - function error($user, $text) {
17640 - $headers['From'] = $user->incomingemail;
17641 - $headers['To'] = $this->addr;
17643 - $headers['Subject'] = _('Command failed');
17644 + return mail_send(array($this->addr), $headers, $text);
17647 + function error($user, $text) {
17649 + $headers['From'] = $user->incomingemail;
17650 + $headers['To'] = $this->addr;
17652 + $headers['Subject'] = _('Command failed');
17653 hunk ./classes/Channel.php 187
17654 - return mail_send(array($this->addr), $headers, $text);
17657 - function set_notify($user, $value) {
17658 - $orig = clone($user);
17659 - $user->smsnotify = $value;
17660 - $result = $user->update($orig);
17662 - common_log_db_error($user, 'UPDATE', __FILE__);
17667 + return mail_send(array($this->addr), $headers, $text);
17670 + function set_notify($user, $value) {
17671 + $orig = clone($user);
17672 + $user->smsnotify = $value;
17673 + $result = $user->update($orig);
17675 + common_log_db_error($user, 'UPDATE', __FILE__);
17680 hunk ./classes/Command.php 25
17682 - var $user = NULL;
17684 - function __construct($user=NULL) {
17685 - $this->user = $user;
17688 - function execute($channel) {
17692 + var $user = NULL;
17694 + function __construct($user=NULL) {
17695 + $this->user = $user;
17698 + function execute($channel) {
17701 hunk ./classes/Command.php 38
17702 - function execute($channel) {
17703 - $channel->error($this->user, _("Sorry, this command is not yet implemented."));
17705 + function execute($channel) {
17706 + $channel->error($this->user, _("Sorry, this command is not yet implemented."));
17708 hunk ./classes/Command.php 50
17709 - var $word = NULL;
17710 - function __construct($user, $word) {
17711 - parent::__construct($user);
17712 - $this->word = $word;
17714 + var $word = NULL;
17715 + function __construct($user, $word) {
17716 + parent::__construct($user);
17717 + $this->word = $word;
17719 hunk ./classes/Command.php 58
17720 - var $word = NULL;
17721 - function __construct($user, $word) {
17722 - parent::__construct($user);
17723 - $this->word = $word;
17725 + var $word = NULL;
17726 + function __construct($user, $word) {
17727 + parent::__construct($user);
17728 + $this->word = $word;
17730 hunk ./classes/Command.php 66
17731 - var $other = NULL;
17732 - function __construct($user, $other) {
17733 - parent::__construct($user);
17734 - $this->other = $other;
17736 + var $other = NULL;
17737 + function __construct($user, $other) {
17738 + parent::__construct($user);
17739 + $this->other = $other;
17741 hunk ./classes/Command.php 74
17742 - var $other = NULL;
17743 - function __construct($user, $other) {
17744 - parent::__construct($user);
17745 - $this->other = $other;
17747 + var $other = NULL;
17748 + function __construct($user, $other) {
17749 + parent::__construct($user);
17750 + $this->other = $other;
17752 hunk ./classes/Command.php 82
17753 - function execute($channel) {
17754 + function execute($channel) {
17755 hunk ./classes/Command.php 84
17756 - $subs = new Subscription();
17757 - $subs->subscriber = $this->user->id;
17758 - $subs_count = (int) $subs->count() - 1;
17759 + $subs = new Subscription();
17760 + $subs->subscriber = $this->user->id;
17761 + $subs_count = (int) $subs->count() - 1;
17762 hunk ./classes/Command.php 88
17763 - $subbed = new Subscription();
17764 - $subbed->subscribed = $this->user->id;
17765 - $subbed_count = (int) $subbed->count() - 1;
17766 + $subbed = new Subscription();
17767 + $subbed->subscribed = $this->user->id;
17768 + $subbed_count = (int) $subbed->count() - 1;
17769 hunk ./classes/Command.php 92
17770 - $notices = new Notice();
17771 - $notices->profile_id = $this->user->id;
17772 - $notice_count = (int) $notices->count();
17774 - $channel->output($this->user, sprintf(_("Subscriptions: %1\$s\n".
17775 - "Subscribers: %2\$s\n".
17776 - "Notices: %3\$s"),
17781 + $notices = new Notice();
17782 + $notices->profile_id = $this->user->id;
17783 + $notice_count = (int) $notices->count();
17785 + $channel->output($this->user, sprintf(_("Subscriptions: %1\$s\n".
17786 + "Subscribers: %2\$s\n".
17787 + "Notices: %3\$s"),
17792 hunk ./classes/Command.php 106
17794 - var $other = NULL;
17796 - function __construct($user, $other) {
17797 - parent::__construct($user);
17798 - $this->other = $other;
17801 - function execute($channel) {
17804 - common_relative_profile($this->user, common_canonical_nickname($this->other));
17806 - if (!$recipient) {
17807 - $channel->error($this->user, _('No such user.'));
17810 - $notice = $recipient->getCurrentNotice();
17812 - $channel->error($this->user, _('User has no last notice'));
17816 - $fave = Fave::addNew($this->user, $notice);
17818 + var $other = NULL;
17820 + function __construct($user, $other) {
17821 + parent::__construct($user);
17822 + $this->other = $other;
17825 + function execute($channel) {
17828 + common_relative_profile($this->user, common_canonical_nickname($this->other));
17830 + if (!$recipient) {
17831 + $channel->error($this->user, _('No such user.'));
17834 + $notice = $recipient->getCurrentNotice();
17836 + $channel->error($this->user, _('User has no last notice'));
17840 + $fave = Fave::addNew($this->user, $notice);
17841 hunk ./classes/Command.php 131
17843 - $channel->error($this->user, _('Could not create favorite.'));
17847 + $channel->error($this->user, _('Could not create favorite.'));
17850 hunk ./classes/Command.php 136
17851 - $other = User::staticGet('id', $recipient->id);
17853 - if ($other && $other->id != $user->id) {
17854 - if ($other->email && $other->emailnotifyfav) {
17855 - mail_notify_fave($other, $this->user, $notice);
17859 - $this->user->blowFavesCache();
17861 - $channel->output($this->user, _('Notice marked as fave.'));
17863 + $other = User::staticGet('id', $recipient->id);
17865 + if ($other && $other->id != $user->id) {
17866 + if ($other->email && $other->emailnotifyfav) {
17867 + mail_notify_fave($other, $this->user, $notice);
17871 + $this->user->blowFavesCache();
17873 + $channel->output($this->user, _('Notice marked as fave.'));
17875 hunk ./classes/Command.php 151
17876 - var $other = NULL;
17877 - function __construct($user, $other) {
17878 - parent::__construct($user);
17879 - $this->other = $other;
17882 - function execute($channel) {
17884 - common_relative_profile($this->user, common_canonical_nickname($this->other));
17886 - if (!$recipient) {
17887 - $channel->error($this->user, _('No such user.'));
17891 - $whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname,
17892 - $recipient->profileurl);
17893 - if ($recipient->fullname) {
17894 - $whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname);
17896 - if ($recipient->location) {
17897 - $whois .= "\n" . sprintf(_('Location: %s'), $recipient->location);
17899 - if ($recipient->homepage) {
17900 - $whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage);
17902 - if ($recipient->bio) {
17903 - $whois .= "\n" . sprintf(_('About: %s'), $recipient->bio);
17905 - $channel->output($this->user, $whois);
17907 + var $other = NULL;
17908 + function __construct($user, $other) {
17909 + parent::__construct($user);
17910 + $this->other = $other;
17913 + function execute($channel) {
17915 + common_relative_profile($this->user, common_canonical_nickname($this->other));
17917 + if (!$recipient) {
17918 + $channel->error($this->user, _('No such user.'));
17922 + $whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname,
17923 + $recipient->profileurl);
17924 + if ($recipient->fullname) {
17925 + $whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname);
17927 + if ($recipient->location) {
17928 + $whois .= "\n" . sprintf(_('Location: %s'), $recipient->location);
17930 + if ($recipient->homepage) {
17931 + $whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage);
17933 + if ($recipient->bio) {
17934 + $whois .= "\n" . sprintf(_('About: %s'), $recipient->bio);
17936 + $channel->output($this->user, $whois);
17938 hunk ./classes/Command.php 185
17939 - var $other = NULL;
17940 - var $text = NULL;
17941 - function __construct($user, $other, $text) {
17942 - parent::__construct($user);
17943 - $this->other = $other;
17944 - $this->text = $text;
17947 - function execute($channel) {
17948 - $other = User::staticGet('nickname', common_canonical_nickname($this->other));
17949 - $len = mb_strlen($this->text);
17951 - $channel->error($this->user, _('No content!'));
17953 - } else if ($len > 140) {
17954 - $content = common_shorten_links($content);
17955 - if (mb_strlen($content) > 140) {
17956 - $channel->error($this->user, sprintf(_('Message too long - maximum is 140 characters, you sent %d'), $len));
17962 - $channel->error($this->user, _('No such user.'));
17964 - } else if (!$this->user->mutuallySubscribed($other)) {
17965 - $channel->error($this->user, _('You can\'t send a message to this user.'));
17967 - } else if ($this->user->id == $other->id) {
17968 - $channel->error($this->user, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
17971 - $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
17973 - $channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
17975 - $channel->error($this->user, _('Error sending direct message.'));
17978 + var $other = NULL;
17979 + var $text = NULL;
17980 + function __construct($user, $other, $text) {
17981 + parent::__construct($user);
17982 + $this->other = $other;
17983 + $this->text = $text;
17986 + function execute($channel) {
17987 + $other = User::staticGet('nickname', common_canonical_nickname($this->other));
17988 + $len = mb_strlen($this->text);
17990 + $channel->error($this->user, _('No content!'));
17992 + } else if ($len > 140) {
17993 + $content = common_shorten_links($content);
17994 + if (mb_strlen($content) > 140) {
17995 + $channel->error($this->user, sprintf(_('Message too long - maximum is 140 characters, you sent %d'), $len));
18001 + $channel->error($this->user, _('No such user.'));
18003 + } else if (!$this->user->mutuallySubscribed($other)) {
18004 + $channel->error($this->user, _('You can\'t send a message to this user.'));
18006 + } else if ($this->user->id == $other->id) {
18007 + $channel->error($this->user, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
18010 + $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
18012 + $channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
18014 + $channel->error($this->user, _('Error sending direct message.'));
18017 hunk ./classes/Command.php 227
18019 - var $other = NULL;
18021 - function __construct($user, $other) {
18022 - parent::__construct($user);
18023 - $this->other = $other;
18026 - function execute($channel) {
18027 - $target_nickname = common_canonical_nickname($this->other);
18030 - common_relative_profile($this->user, $target_nickname);
18032 + var $other = NULL;
18034 + function __construct($user, $other) {
18035 + parent::__construct($user);
18036 + $this->other = $other;
18039 + function execute($channel) {
18040 + $target_nickname = common_canonical_nickname($this->other);
18043 + common_relative_profile($this->user, $target_nickname);
18044 hunk ./classes/Command.php 241
18046 - $channel->error($this->user, _('No such user.'));
18049 - $notice = $target->getCurrentNotice();
18051 - $channel->error($this->user, _('User has no last notice'));
18054 - $notice_content = $notice->content;
18056 - $channel->output($this->user, $target_nickname . ": " . $notice_content);
18059 + $channel->error($this->user, _('No such user.'));
18062 + $notice = $target->getCurrentNotice();
18064 + $channel->error($this->user, _('User has no last notice'));
18067 + $notice_content = $notice->content;
18069 + $channel->output($this->user, $target_nickname . ": " . $notice_content);
18071 hunk ./classes/Command.php 257
18073 - var $other = NULL;
18075 - function __construct($user, $other) {
18076 - parent::__construct($user);
18077 - $this->other = $other;
18080 - function execute($channel) {
18082 - if (!$this->other) {
18083 - $channel->error($this->user, _('Specify the name of the user to subscribe to'));
18087 - $result = subs_subscribe_user($this->user, $this->other);
18089 - if ($result == 'true') {
18090 - $channel->output($this->user, sprintf(_('Subscribed to %s'), $this->other));
18092 - $channel->error($this->user, $result);
18096 + var $other = NULL;
18098 + function __construct($user, $other) {
18099 + parent::__construct($user);
18100 + $this->other = $other;
18103 + function execute($channel) {
18105 + if (!$this->other) {
18106 + $channel->error($this->user, _('Specify the name of the user to subscribe to'));
18110 + $result = subs_subscribe_user($this->user, $this->other);
18112 + if ($result == 'true') {
18113 + $channel->output($this->user, sprintf(_('Subscribed to %s'), $this->other));
18115 + $channel->error($this->user, $result);
18118 hunk ./classes/Command.php 284
18119 - var $other = NULL;
18121 - function __construct($user, $other) {
18122 - parent::__construct($user);
18123 - $this->other = $other;
18125 + var $other = NULL;
18127 + function __construct($user, $other) {
18128 + parent::__construct($user);
18129 + $this->other = $other;
18131 hunk ./classes/Command.php 291
18132 - function execute($channel) {
18133 - if(!$this->other) {
18134 - $channel->error($this->user, _('Specify the name of the user to unsubscribe from'));
18138 - $result=subs_unsubscribe_user($this->user, $this->other);
18141 - $channel->output($this->user, sprintf(_('Unsubscribed from %s'), $this->other));
18143 - $channel->error($this->user, $result);
18146 + function execute($channel) {
18147 + if(!$this->other) {
18148 + $channel->error($this->user, _('Specify the name of the user to unsubscribe from'));
18152 + $result=subs_unsubscribe_user($this->user, $this->other);
18155 + $channel->output($this->user, sprintf(_('Unsubscribed from %s'), $this->other));
18157 + $channel->error($this->user, $result);
18160 hunk ./classes/Command.php 308
18161 - var $other = NULL;
18162 - function __construct($user, $other=NULL) {
18163 - parent::__construct($user);
18164 - $this->other = $other;
18166 - function execute($channel) {
18168 - $channel->error($this->user, _("Command not yet implemented."));
18170 - if ($channel->off($this->user)) {
18171 - $channel->output($this->user, _('Notification off.'));
18173 - $channel->error($this->user, _('Can\'t turn off notification.'));
18177 + var $other = NULL;
18178 + function __construct($user, $other=NULL) {
18179 + parent::__construct($user);
18180 + $this->other = $other;
18182 + function execute($channel) {
18184 + $channel->error($this->user, _("Command not yet implemented."));
18186 + if ($channel->off($this->user)) {
18187 + $channel->output($this->user, _('Notification off.'));
18189 + $channel->error($this->user, _('Can\'t turn off notification.'));
18193 hunk ./classes/Command.php 327
18194 - var $other = NULL;
18195 - function __construct($user, $other=NULL) {
18196 - parent::__construct($user);
18197 - $this->other = $other;
18200 - function execute($channel) {
18202 - $channel->error($this->user, _("Command not yet implemented."));
18204 - if ($channel->on($this->user)) {
18205 - $channel->output($this->user, _('Notification on.'));
18207 - $channel->error($this->user, _('Can\'t turn on notification.'));
18211 + var $other = NULL;
18212 + function __construct($user, $other=NULL) {
18213 + parent::__construct($user);
18214 + $this->other = $other;
18217 + function execute($channel) {
18219 + $channel->error($this->user, _("Command not yet implemented."));
18221 + if ($channel->on($this->user)) {
18222 + $channel->output($this->user, _('Notification on.'));
18224 + $channel->error($this->user, _('Can\'t turn on notification.'));
18228 hunk ./classes/Command.php 347
18229 - function execute($channel) {
18230 - $channel->output($this->user,
18232 - "on - turn on notifications\n".
18233 - "off - turn off notifications\n".
18234 - "help - show this help\n".
18235 - "follow <nickname> - subscribe to user\n".
18236 - "leave <nickname> - unsubscribe from user\n".
18237 - "d <nickname> <text> - direct message to user\n".
18238 - "get <nickname> - get last notice from user\n".
18239 - "whois <nickname> - get profile info on user\n".
18240 - "fav <nickname> - add user's last notice as a 'fave'\n".
18241 - "stats - get your stats\n".
18242 - "stop - same as 'off'\n".
18243 - "quit - same as 'off'\n".
18244 - "sub <nickname> - same as 'follow'\n".
18245 - "unsub <nickname> - same as 'leave'\n".
18246 - "last <nickname> - same as 'get'\n".
18247 - "on <nickname> - not yet implemented.\n".
18248 - "off <nickname> - not yet implemented.\n".
18249 - "nudge <nickname> - not yet implemented.\n".
18250 - "invite <phone number> - not yet implemented.\n".
18251 - "track <word> - not yet implemented.\n".
18252 - "untrack <word> - not yet implemented.\n".
18253 - "track off - not yet implemented.\n".
18254 - "untrack all - not yet implemented.\n".
18255 - "tracks - not yet implemented.\n".
18256 - "tracking - not yet implemented.\n"));
18258 + function execute($channel) {
18259 + $channel->output($this->user,
18261 + "on - turn on notifications\n".
18262 + "off - turn off notifications\n".
18263 + "help - show this help\n".
18264 + "follow <nickname> - subscribe to user\n".
18265 + "leave <nickname> - unsubscribe from user\n".
18266 + "d <nickname> <text> - direct message to user\n".
18267 + "get <nickname> - get last notice from user\n".
18268 + "whois <nickname> - get profile info on user\n".
18269 + "fav <nickname> - add user's last notice as a 'fave'\n".
18270 + "stats - get your stats\n".
18271 + "stop - same as 'off'\n".
18272 + "quit - same as 'off'\n".
18273 + "sub <nickname> - same as 'follow'\n".
18274 + "unsub <nickname> - same as 'leave'\n".
18275 + "last <nickname> - same as 'get'\n".
18276 + "on <nickname> - not yet implemented.\n".
18277 + "off <nickname> - not yet implemented.\n".
18278 + "nudge <nickname> - not yet implemented.\n".
18279 + "invite <phone number> - not yet implemented.\n".
18280 + "track <word> - not yet implemented.\n".
18281 + "untrack <word> - not yet implemented.\n".
18282 + "track off - not yet implemented.\n".
18283 + "untrack all - not yet implemented.\n".
18284 + "tracks - not yet implemented.\n".
18285 + "tracking - not yet implemented.\n"));
18287 hunk ./classes/CommandInterpreter.php 25
18289 - function handle_command($user, $text) {
18292 + function handle_command($user, $text) {
18294 hunk ./classes/CommandInterpreter.php 29
18295 - $text = preg_replace('/\s+/', ' ', trim($text));
18296 - list($cmd, $arg) = explode(' ', $text, 2);
18297 + $text = preg_replace('/\s+/', ' ', trim($text));
18298 + list($cmd, $arg) = explode(' ', $text, 2);
18299 hunk ./classes/CommandInterpreter.php 32
18300 - # We try to support all the same commands as Twitter, see
18301 - # http://getsatisfaction.com/twitter/topics/what_are_the_twitter_commands
18302 - # There are a few compatibility commands from earlier versions of
18305 - switch(strtolower($cmd)) {
18310 - return new HelpCommand($user);
18313 - list($other, $extra) = explode(' ', $arg, 2);
18317 - return new OnCommand($user, $other);
18320 - return new OnCommand($user);
18324 - list($other, $extra) = explode(' ', $arg, 2);
18328 - return new OffCommand($user, $other);
18331 - return new OffCommand($user);
18338 - return new OffCommand($user);
18345 - list($other, $extra) = explode(' ', $arg, 2);
18349 - return new SubCommand($user, $other);
18356 - list($other, $extra) = explode(' ', $arg, 2);
18360 - return new UnsubCommand($user, $other);
18367 - list($other, $extra) = explode(' ', $arg, 2);
18371 - return new GetCommand($user, $other);
18377 - list($other, $extra) = explode(' ', $arg, 2);
18381 - return new MessageCommand($user, $other, $extra);
18387 - list($other, $extra) = explode(' ', $arg, 2);
18391 - return new WhoisCommand($user, $other);
18397 - list($other, $extra) = explode(' ', $arg, 2);
18401 - return new FavCommand($user, $other);
18407 - list($other, $extra) = explode(' ', $arg, 2);
18411 - return new NudgeCommand($user, $other);
18417 - return new StatsCommand($user);
18422 - list($other, $extra) = explode(' ', $arg, 2);
18426 - return new InviteCommand($user, $other);
18432 - list($word, $extra) = explode(' ', $arg, 2);
18435 - } else if ($word == 'off') {
18436 - return new TrackOffCommand($user);
18438 - return new TrackCommand($user, $word);
18444 - list($word, $extra) = explode(' ', $arg, 2);
18447 - } else if ($word == 'all') {
18448 - return new TrackOffCommand($user);
18450 - return new UntrackCommand($user, $word);
18457 - return new TrackingCommand($user);
18462 + # We try to support all the same commands as Twitter, see
18463 + # http://getsatisfaction.com/twitter/topics/what_are_the_twitter_commands
18464 + # There are a few compatibility commands from earlier versions of
18467 + switch(strtolower($cmd)) {
18472 + return new HelpCommand($user);
18475 + list($other, $extra) = explode(' ', $arg, 2);
18479 + return new OnCommand($user, $other);
18482 + return new OnCommand($user);
18486 + list($other, $extra) = explode(' ', $arg, 2);
18490 + return new OffCommand($user, $other);
18493 + return new OffCommand($user);
18500 + return new OffCommand($user);
18507 + list($other, $extra) = explode(' ', $arg, 2);
18511 + return new SubCommand($user, $other);
18518 + list($other, $extra) = explode(' ', $arg, 2);
18522 + return new UnsubCommand($user, $other);
18529 + list($other, $extra) = explode(' ', $arg, 2);
18533 + return new GetCommand($user, $other);
18539 + list($other, $extra) = explode(' ', $arg, 2);
18543 + return new MessageCommand($user, $other, $extra);
18549 + list($other, $extra) = explode(' ', $arg, 2);
18553 + return new WhoisCommand($user, $other);
18559 + list($other, $extra) = explode(' ', $arg, 2);
18563 + return new FavCommand($user, $other);
18569 + list($other, $extra) = explode(' ', $arg, 2);
18573 + return new NudgeCommand($user, $other);
18579 + return new StatsCommand($user);
18584 + list($other, $extra) = explode(' ', $arg, 2);
18588 + return new InviteCommand($user, $other);
18594 + list($word, $extra) = explode(' ', $arg, 2);
18597 + } else if ($word == 'off') {
18598 + return new TrackOffCommand($user);
18600 + return new TrackCommand($user, $word);
18606 + list($word, $extra) = explode(' ', $arg, 2);
18609 + } else if ($word == 'all') {
18610 + return new TrackOffCommand($user);
18612 + return new UntrackCommand($user, $word);
18619 + return new TrackingCommand($user);
18624 hunk ./classes/Fave.php 23
18625 - static function addNew($user, $notice) {
18626 - $fave = new Fave();
18627 - $fave->user_id = $user->id;
18628 - $fave->notice_id = $notice->id;
18629 - if (!$fave->insert()) {
18630 - common_log_db_error($fave, 'INSERT', __FILE__);
18636 - function &pkeyGet($kv) {
18637 - return Memcached_DataObject::pkeyGet('Fave', $kv);
18639 + static function addNew($user, $notice) {
18640 + $fave = new Fave();
18641 + $fave->user_id = $user->id;
18642 + $fave->notice_id = $notice->id;
18643 + if (!$fave->insert()) {
18644 + common_log_db_error($fave, 'INSERT', __FILE__);
18650 + function &pkeyGet($kv) {
18651 + return Memcached_DataObject::pkeyGet('Fave', $kv);
18653 hunk ./classes/Foreign_link.php 29
18654 - // XXX: This only returns a 1->1 single obj mapping. Change? Or make
18655 - // a getForeignUsers() that returns more than one? --Zach
18656 - static function getByUserID($user_id, $service) {
18657 - $flink = new Foreign_link();
18658 - $flink->service = $service;
18659 - $flink->user_id = $user_id;
18660 - $flink->limit(1);
18661 + // XXX: This only returns a 1->1 single obj mapping. Change? Or make
18662 + // a getForeignUsers() that returns more than one? --Zach
18663 + static function getByUserID($user_id, $service) {
18664 + $flink = new Foreign_link();
18665 + $flink->service = $service;
18666 + $flink->user_id = $user_id;
18667 + $flink->limit(1);
18668 hunk ./classes/Foreign_link.php 37
18669 - if ($flink->find(TRUE)) {
18672 + if ($flink->find(TRUE)) {
18675 hunk ./classes/Foreign_link.php 41
18679 - static function getByForeignID($foreign_id, $service) {
18680 - $flink = new Foreign_link();
18681 - $flink->service = $service;
18682 - $flink->foreign_id = $foreign_id;
18683 - $flink->limit(1);
18687 + static function getByForeignID($foreign_id, $service) {
18688 + $flink = new Foreign_link();
18689 + $flink->service = $service;
18690 + $flink->foreign_id = $foreign_id;
18691 + $flink->limit(1);
18692 hunk ./classes/Foreign_link.php 50
18693 - if ($flink->find(TRUE)) {
18696 + if ($flink->find(TRUE)) {
18699 hunk ./classes/Foreign_link.php 54
18703 - # Convenience methods
18704 - function getForeignUser() {
18705 - $fuser = new Foreign_user();
18706 - $fuser->service = $this->service;
18707 - $fuser->id = $this->foreign_id;
18709 - $fuser->limit(1);
18711 - if ($fuser->find(TRUE)) {
18718 - function getUser() {
18719 - return User::staticGet($this->user_id);
18725 + # Convenience methods
18726 + function getForeignUser() {
18727 + $fuser = new Foreign_user();
18728 + $fuser->service = $this->service;
18729 + $fuser->id = $this->foreign_id;
18731 + $fuser->limit(1);
18733 + if ($fuser->find(TRUE)) {
18740 + function getUser() {
18741 + return User::staticGet($this->user_id);
18744 hunk ./classes/Foreign_user.php 25
18746 - // XXX: This only returns a 1->1 single obj mapping. Change? Or make
18747 - // a getForeignUsers() that returns more than one? --Zach
18748 - static function getForeignUser($id, $service) {
18749 - $fuser = new Foreign_user();
18750 - $fuser->whereAdd("service = $service");
18751 - $fuser->whereAdd("id = $id");
18752 - $fuser->limit(1);
18754 - if ($fuser->find()) {
18762 - function updateKeys(&$orig) {
18763 - $parts = array();
18764 - foreach (array('id', 'service', 'uri', 'nickname') as $k) {
18765 - if (strcmp($this->$k, $orig->$k) != 0) {
18766 - $parts[] = $k . ' = ' . $this->_quote($this->$k);
18769 - if (count($parts) == 0) {
18773 - $toupdate = implode(', ', $parts);
18775 + // XXX: This only returns a 1->1 single obj mapping. Change? Or make
18776 + // a getForeignUsers() that returns more than one? --Zach
18777 + static function getForeignUser($id, $service) {
18778 + $fuser = new Foreign_user();
18779 + $fuser->whereAdd("service = $service");
18780 + $fuser->whereAdd("id = $id");
18781 + $fuser->limit(1);
18783 + if ($fuser->find()) {
18791 + function updateKeys(&$orig) {
18792 + $parts = array();
18793 + foreach (array('id', 'service', 'uri', 'nickname') as $k) {
18794 + if (strcmp($this->$k, $orig->$k) != 0) {
18795 + $parts[] = $k . ' = ' . $this->_quote($this->$k);
18798 + if (count($parts) == 0) {
18802 + $toupdate = implode(', ', $parts);
18803 hunk ./classes/Foreign_user.php 55
18804 - $table = $this->tableName();
18805 - if(common_config('db','quote_identifiers')) {
18806 - $table = '"' . $table . '"';
18808 - $qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
18809 - ' WHERE id = ' . $this->id;
18810 - $orig->decache();
18811 - $result = $this->query($qry);
18813 - $this->encache();
18817 + $table = $this->tableName();
18818 + if(common_config('db','quote_identifiers')) {
18819 + $table = '"' . $table . '"';
18821 + $qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
18822 + ' WHERE id = ' . $this->id;
18823 + $orig->decache();
18824 + $result = $this->query($qry);
18826 + $this->encache();
18830 hunk ./classes/Foreign_user.php 69
18833 hunk ./classes/Memcached_DataObject.php 27
18834 - if (is_null($v)) {
18838 - $keys = $i->keys();
18842 - $i = Memcached_DataObject::getcached($cls, $k, $v);
18846 - $i = DB_DataObject::staticGet($cls, $k, $v);
18853 + if (is_null($v)) {
18857 + $keys = $i->keys();
18861 + $i = Memcached_DataObject::getcached($cls, $k, $v);
18865 + $i = DB_DataObject::staticGet($cls, $k, $v);
18872 hunk ./classes/Memcached_DataObject.php 47
18873 - function &pkeyGet($cls, $kv) {
18874 - $i = Memcached_DataObject::multicache($cls, $kv);
18879 - foreach ($kv as $k => $v) {
18882 - if ($i->find(true)) {
18887 + function &pkeyGet($cls, $kv) {
18888 + $i = Memcached_DataObject::multicache($cls, $kv);
18893 + foreach ($kv as $k => $v) {
18896 + if ($i->find(true)) {
18901 hunk ./classes/Memcached_DataObject.php 62
18906 hunk ./classes/Memcached_DataObject.php 65
18907 - function insert() {
18908 - $result = parent::insert();
18912 - function update($orig=NULL) {
18913 - if (is_object($orig) && $orig instanceof Memcached_DataObject) {
18914 - $orig->decache(); # might be different keys
18916 - $result = parent::update($orig);
18918 - $this->encache();
18923 - function delete() {
18924 - $this->decache(); # while we still have the values!
18925 - return parent::delete();
18928 - static function memcache() {
18929 - return common_memcache();
18932 - static function cacheKey($cls, $k, $v) {
18933 - return common_cache_key(strtolower($cls).':'.$k.':'.$v);
18936 - static function getcached($cls, $k, $v) {
18937 - $c = Memcached_DataObject::memcache();
18941 - return $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
18944 + function insert() {
18945 + $result = parent::insert();
18949 + function update($orig=NULL) {
18950 + if (is_object($orig) && $orig instanceof Memcached_DataObject) {
18951 + $orig->decache(); # might be different keys
18953 + $result = parent::update($orig);
18955 + $this->encache();
18960 + function delete() {
18961 + $this->decache(); # while we still have the values!
18962 + return parent::delete();
18965 + static function memcache() {
18966 + return common_memcache();
18969 + static function cacheKey($cls, $k, $v) {
18970 + return common_cache_key(strtolower($cls).':'.$k.':'.$v);
18973 + static function getcached($cls, $k, $v) {
18974 + $c = Memcached_DataObject::memcache();
18978 + return $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
18981 hunk ./classes/Memcached_DataObject.php 103
18982 - function keyTypes() {
18983 - global $_DB_DATAOBJECT;
18984 + function keyTypes() {
18985 + global $_DB_DATAOBJECT;
18986 hunk ./classes/Memcached_DataObject.php 106
18987 - $this->databaseStructure();
18988 + $this->databaseStructure();
18989 hunk ./classes/Memcached_DataObject.php 109
18990 - return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
18993 - function encache() {
18994 - $c = $this->memcache();
19000 - $types = $this->keyTypes();
19002 - foreach ($types as $key => $type) {
19003 - if ($type == 'K') {
19005 - $pval[] = $this->$key;
19007 - $c->set($this->cacheKey($this->tableName(), $key, $this->$key), $this);
19010 - # XXX: should work for both compound and scalar pkeys
19011 - $pvals = implode(',', $pval);
19012 - $pkeys = implode(',', $pkey);
19013 - $c->set($this->cacheKey($this->tableName(), $pkeys, $pvals), $this);
19017 - function decache() {
19018 - $c = $this->memcache();
19024 - $types = $this->keyTypes();
19026 - foreach ($types as $key => $type) {
19027 - if ($type == 'K') {
19029 - $pval[] = $this->$key;
19031 - $c->delete($this->cacheKey($this->tableName(), $key, $this->$key));
19034 - # should work for both compound and scalar pkeys
19035 - # XXX: comma works for now but may not be safe separator for future keys
19036 - $pvals = implode(',', $pval);
19037 - $pkeys = implode(',', $pkey);
19038 - $c->delete($this->cacheKey($this->tableName(), $pkeys, $pvals));
19041 + return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
19044 + function encache() {
19045 + $c = $this->memcache();
19051 + $types = $this->keyTypes();
19053 + foreach ($types as $key => $type) {
19054 + if ($type == 'K') {
19056 + $pval[] = $this->$key;
19058 + $c->set($this->cacheKey($this->tableName(), $key, $this->$key), $this);
19061 + # XXX: should work for both compound and scalar pkeys
19062 + $pvals = implode(',', $pval);
19063 + $pkeys = implode(',', $pkey);
19064 + $c->set($this->cacheKey($this->tableName(), $pkeys, $pvals), $this);
19068 + function decache() {
19069 + $c = $this->memcache();
19075 + $types = $this->keyTypes();
19077 + foreach ($types as $key => $type) {
19078 + if ($type == 'K') {
19080 + $pval[] = $this->$key;
19082 + $c->delete($this->cacheKey($this->tableName(), $key, $this->$key));
19085 + # should work for both compound and scalar pkeys
19086 + # XXX: comma works for now but may not be safe separator for future keys
19087 + $pvals = implode(',', $pval);
19088 + $pkeys = implode(',', $pkey);
19089 + $c->delete($this->cacheKey($this->tableName(), $pkeys, $pvals));
19092 hunk ./classes/Memcached_DataObject.php 161
19093 - function multicache($cls, $kv) {
19095 - $c = Memcached_DataObject::memcache();
19099 - $pkeys = implode(',', array_keys($kv));
19100 - $pvals = implode(',', array_values($kv));
19101 - return $c->get(Memcached_DataObject::cacheKey($cls, $pkeys, $pvals));
19104 + function multicache($cls, $kv) {
19106 + $c = Memcached_DataObject::memcache();
19110 + $pkeys = implode(',', array_keys($kv));
19111 + $pvals = implode(',', array_values($kv));
19112 + return $c->get(Memcached_DataObject::cacheKey($cls, $pkeys, $pvals));
19115 hunk ./classes/Message.php 29
19117 - function getFrom() {
19118 - return Profile::staticGet('id', $this->from_profile);
19121 - function getTo() {
19122 - return Profile::staticGet('id', $this->to_profile);
19125 - static function saveNew($from, $to, $content, $source) {
19127 - $msg = new Message();
19129 - $msg->from_profile = $from;
19130 - $msg->to_profile = $to;
19131 - $msg->content = common_shorten_links($content);
19132 - $msg->rendered = common_render_text($content);
19133 - $msg->created = common_sql_now();
19134 - $msg->source = $source;
19136 - $result = $msg->insert();
19139 - common_log_db_error($msg, 'INSERT', __FILE__);
19140 - return _('Could not insert message.');
19143 - $orig = clone($msg);
19144 - $msg->uri = common_local_url('showmessage', array('message' => $msg->id));
19146 - $result = $msg->update($orig);
19149 - common_log_db_error($msg, 'UPDATE', __FILE__);
19150 - return _('Could not update message with new URI.');
19156 + function getFrom() {
19157 + return Profile::staticGet('id', $this->from_profile);
19160 + function getTo() {
19161 + return Profile::staticGet('id', $this->to_profile);
19164 + static function saveNew($from, $to, $content, $source) {
19166 + $msg = new Message();
19168 + $msg->from_profile = $from;
19169 + $msg->to_profile = $to;
19170 + $msg->content = common_shorten_links($content);
19171 + $msg->rendered = common_render_text($content);
19172 + $msg->created = common_sql_now();
19173 + $msg->source = $source;
19175 + $result = $msg->insert();
19178 + common_log_db_error($msg, 'INSERT', __FILE__);
19179 + return _('Could not insert message.');
19182 + $orig = clone($msg);
19183 + $msg->uri = common_local_url('showmessage', array('message' => $msg->id));
19185 + $result = $msg->update($orig);
19188 + common_log_db_error($msg, 'UPDATE', __FILE__);
19189 + return _('Could not update message with new URI.');
19194 hunk ./classes/Notice.php 13
19195 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19196 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19197 hunk ./classes/Notice.php 17
19198 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
19199 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
19200 hunk ./classes/Notice.php 34
19201 - ###START_AUTOCODE
19202 - /* the code below is auto generated do not remove the above tag */
19203 + ###START_AUTOCODE
19204 + /* the code below is auto generated do not remove the above tag */
19205 hunk ./classes/Notice.php 37
19206 - public $__table = 'notice'; // table name
19207 - public $id; // int(4) primary_key not_null
19208 - public $profile_id; // int(4) not_null
19209 - public $uri; // varchar(255) unique_key
19210 - public $content; // varchar(140)
19211 - public $rendered; // text()
19212 - public $url; // varchar(255)
19213 - public $created; // datetime() not_null
19214 - public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
19215 - public $reply_to; // int(4)
19216 - public $is_local; // tinyint(1)
19217 - public $source; // varchar(32)
19218 + public $__table = 'notice'; // table name
19219 + public $id; // int(4) primary_key not_null
19220 + public $profile_id; // int(4) not_null
19221 + public $uri; // varchar(255) unique_key
19222 + public $content; // varchar(140)
19223 + public $rendered; // text()
19224 + public $url; // varchar(255)
19225 + public $created; // datetime() not_null
19226 + public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
19227 + public $reply_to; // int(4)
19228 + public $is_local; // tinyint(1)
19229 + public $source; // varchar(32)
19230 hunk ./classes/Notice.php 50
19232 - function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
19234 + function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
19235 hunk ./classes/Notice.php 53
19236 - /* the code above is auto generated do not remove the tag below */
19238 + /* the code above is auto generated do not remove the tag below */
19240 hunk ./classes/Notice.php 56
19241 - function getProfile() {
19242 - return Profile::staticGet('id', $this->profile_id);
19244 + function getProfile() {
19245 + return Profile::staticGet('id', $this->profile_id);
19247 hunk ./classes/Notice.php 60
19248 - function delete() {
19249 - $this->blowCaches(true);
19250 - $this->blowFavesCache(true);
19251 - $this->blowInboxes();
19252 - return parent::delete();
19254 + function delete() {
19255 + $this->blowCaches(true);
19256 + $this->blowFavesCache(true);
19257 + $this->blowInboxes();
19258 + return parent::delete();
19260 hunk ./classes/Notice.php 67
19261 - function saveTags() {
19262 - /* extract all #hastags */
19263 - $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match);
19267 + function saveTags() {
19268 + /* extract all #hastags */
19269 + $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match);
19273 hunk ./classes/Notice.php 74
19274 - /* elide characters we don't want in the tag */
19275 - $match[1] = str_replace(array('-', '_', '.'), '', $match[1]);
19276 + /* elide characters we don't want in the tag */
19277 + $match[1] = str_replace(array('-', '_', '.'), '', $match[1]);
19278 hunk ./classes/Notice.php 77
19279 - /* Add them to the database */
19280 - foreach(array_unique($match[1]) as $hashtag) {
19281 - $tag = DB_DataObject::factory('Notice_tag');
19282 - $tag->notice_id = $this->id;
19283 - $tag->tag = $hashtag;
19284 - $tag->created = $this->created;
19285 - $id = $tag->insert();
19287 - $last_error = PEAR::getStaticProperty('DB_DataObject','lastError');
19288 - common_log(LOG_ERR, 'DB error inserting hashtag: ' . $last_error->message);
19289 - common_server_error(sprintf(_('DB error inserting hashtag: %s'), $last_error->message));
19295 + /* Add them to the database */
19296 + foreach(array_unique($match[1]) as $hashtag) {
19297 + $tag = DB_DataObject::factory('Notice_tag');
19298 + $tag->notice_id = $this->id;
19299 + $tag->tag = $hashtag;
19300 + $tag->created = $this->created;
19301 + $id = $tag->insert();
19303 + $last_error = PEAR::getStaticProperty('DB_DataObject','lastError');
19304 + common_log(LOG_ERR, 'DB error inserting hashtag: ' . $last_error->message);
19305 + common_server_error(sprintf(_('DB error inserting hashtag: %s'), $last_error->message));
19311 hunk ./classes/Notice.php 94
19312 - static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
19313 + static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
19314 hunk ./classes/Notice.php 96
19315 - $profile = Profile::staticGet($profile_id);
19316 + $profile = Profile::staticGet($profile_id);
19317 hunk ./classes/Notice.php 105
19318 - return _('Too many notices too fast; take a breather and post again in a few minutes.');
19319 + return _('Too many notices too fast; take a breather and post again in a few minutes.');
19320 hunk ./classes/Notice.php 108
19321 - $banned = common_config('profile', 'banned');
19322 + $banned = common_config('profile', 'banned');
19323 hunk ./classes/Notice.php 110
19324 - if ( in_array($profile_id, $banned) || in_array($profile->nickname, $banned)) {
19325 - common_log(LOG_WARNING, "Attempted post from banned user: $profile->nickname (user id = $profile_id).");
19326 + if ( in_array($profile_id, $banned) || in_array($profile->nickname, $banned)) {
19327 + common_log(LOG_WARNING, "Attempted post from banned user: $profile->nickname (user id = $profile_id).");
19328 hunk ./classes/Notice.php 113
19331 hunk ./classes/Notice.php 115
19332 - $notice = new Notice();
19333 - $notice->profile_id = $profile_id;
19334 + $notice = new Notice();
19335 + $notice->profile_id = $profile_id;
19336 hunk ./classes/Notice.php 118
19337 - $blacklist = common_config('public', 'blacklist');
19338 + $blacklist = common_config('public', 'blacklist');
19339 hunk ./classes/Notice.php 120
19340 - # Blacklisted are non-false, but not 1, either
19341 + # Blacklisted are non-false, but not 1, either
19342 hunk ./classes/Notice.php 122
19343 - if ($blacklist && in_array($profile_id, $blacklist)) {
19344 - $notice->is_local = -1;
19346 - $notice->is_local = $is_local;
19348 + if ($blacklist && in_array($profile_id, $blacklist)) {
19349 + $notice->is_local = -1;
19351 + $notice->is_local = $is_local;
19353 hunk ./classes/Notice.php 128
19354 - $notice->reply_to = $reply_to;
19355 - $notice->created = common_sql_now();
19356 - $notice->content = common_shorten_links($content);
19357 - $notice->rendered = common_render_content($notice->content, $notice);
19358 - $notice->source = $source;
19359 - $notice->uri = $uri;
19360 + $notice->reply_to = $reply_to;
19361 + $notice->created = common_sql_now();
19362 + $notice->content = common_shorten_links($content);
19363 + $notice->rendered = common_render_content($notice->content, $notice);
19364 + $notice->source = $source;
19365 + $notice->uri = $uri;
19366 hunk ./classes/Notice.php 135
19367 - $id = $notice->insert();
19368 + $id = $notice->insert();
19369 hunk ./classes/Notice.php 137
19371 - common_log_db_error($notice, 'INSERT', __FILE__);
19372 - return _('Problem saving notice.');
19375 + common_log_db_error($notice, 'INSERT', __FILE__);
19376 + return _('Problem saving notice.');
19378 hunk ./classes/Notice.php 142
19379 - # Update the URI after the notice is in the database
19381 - $orig = clone($notice);
19382 - $notice->uri = common_notice_uri($notice);
19383 + # Update the URI after the notice is in the database
19385 + $orig = clone($notice);
19386 + $notice->uri = common_notice_uri($notice);
19387 hunk ./classes/Notice.php 147
19388 - if (!$notice->update($orig)) {
19389 - common_log_db_error($notice, 'UPDATE', __FILE__);
19390 - return _('Problem saving notice.');
19393 + if (!$notice->update($orig)) {
19394 + common_log_db_error($notice, 'UPDATE', __FILE__);
19395 + return _('Problem saving notice.');
19398 hunk ./classes/Notice.php 153
19399 - # XXX: do we need to change this for remote users?
19400 + # XXX: do we need to change this for remote users?
19401 hunk ./classes/Notice.php 155
19402 - common_save_replies($notice);
19403 - $notice->saveTags();
19404 + common_save_replies($notice);
19405 + $notice->saveTags();
19406 hunk ./classes/Notice.php 158
19407 - # Clear the cache for subscribed users, so they'll update at next request
19408 - # XXX: someone clever could prepend instead of clearing the cache
19409 + # Clear the cache for subscribed users, so they'll update at next request
19410 + # XXX: someone clever could prepend instead of clearing the cache
19411 hunk ./classes/Notice.php 161
19412 - if (common_config('memcached', 'enabled')) {
19413 - $notice->blowCaches();
19415 + if (common_config('memcached', 'enabled')) {
19416 + $notice->blowCaches();
19418 hunk ./classes/Notice.php 165
19419 - $notice->addToInboxes();
19422 + $notice->addToInboxes();
19425 hunk ./classes/Notice.php 187
19426 - function blowCaches($blowLast=false) {
19427 - $this->blowSubsCache($blowLast);
19428 - $this->blowNoticeCache($blowLast);
19429 - $this->blowRepliesCache($blowLast);
19430 - $this->blowPublicCache($blowLast);
19431 - $this->blowTagCache($blowLast);
19433 + function blowCaches($blowLast=false) {
19434 + $this->blowSubsCache($blowLast);
19435 + $this->blowNoticeCache($blowLast);
19436 + $this->blowRepliesCache($blowLast);
19437 + $this->blowPublicCache($blowLast);
19438 + $this->blowTagCache($blowLast);
19440 hunk ./classes/Notice.php 195
19441 - function blowTagCache($blowLast=false) {
19442 - $cache = common_memcache();
19444 - $tag = new Notice_tag();
19445 - $tag->notice_id = $this->id;
19446 - if ($tag->find()) {
19447 - while ($tag->fetch()) {
19448 - $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag));
19450 - $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag . ';last'));
19458 + function blowTagCache($blowLast=false) {
19459 + $cache = common_memcache();
19461 + $tag = new Notice_tag();
19462 + $tag->notice_id = $this->id;
19463 + if ($tag->find()) {
19464 + while ($tag->fetch()) {
19465 + $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag));
19467 + $cache->delete(common_cache_key('notice_tag:notice_stream:' . $tag->tag . ';last'));
19475 hunk ./classes/Notice.php 213
19476 - function blowSubsCache($blowLast=false) {
19477 - $cache = common_memcache();
19479 - $user = new User();
19480 + function blowSubsCache($blowLast=false) {
19481 + $cache = common_memcache();
19483 + $user = new User();
19484 hunk ./classes/Notice.php 218
19485 - $user->query('SELECT id ' .
19486 - 'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
19487 - 'WHERE subscription.subscribed = ' . $this->profile_id);
19488 + $user->query('SELECT id ' .
19489 + 'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
19490 + 'WHERE subscription.subscribed = ' . $this->profile_id);
19491 hunk ./classes/Notice.php 222
19492 - while ($user->fetch()) {
19493 - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
19495 - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id . ';last'));
19502 + while ($user->fetch()) {
19503 + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
19505 + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id . ';last'));
19512 hunk ./classes/Notice.php 233
19513 - function blowNoticeCache($blowLast=false) {
19514 - if ($this->is_local) {
19515 - $cache = common_memcache();
19517 - $cache->delete(common_cache_key('profile:notices:'.$this->profile_id));
19519 - $cache->delete(common_cache_key('profile:notices:'.$this->profile_id.';last'));
19524 + function blowNoticeCache($blowLast=false) {
19525 + if ($this->is_local) {
19526 + $cache = common_memcache();
19528 + $cache->delete(common_cache_key('profile:notices:'.$this->profile_id));
19530 + $cache->delete(common_cache_key('profile:notices:'.$this->profile_id.';last'));
19535 hunk ./classes/Notice.php 245
19536 - function blowRepliesCache($blowLast=false) {
19537 - $cache = common_memcache();
19539 - $reply = new Reply();
19540 - $reply->notice_id = $this->id;
19541 - if ($reply->find()) {
19542 - while ($reply->fetch()) {
19543 - $cache->delete(common_cache_key('user:replies:'.$reply->profile_id));
19545 - $cache->delete(common_cache_key('user:replies:'.$reply->profile_id.';last'));
19553 + function blowRepliesCache($blowLast=false) {
19554 + $cache = common_memcache();
19556 + $reply = new Reply();
19557 + $reply->notice_id = $this->id;
19558 + if ($reply->find()) {
19559 + while ($reply->fetch()) {
19560 + $cache->delete(common_cache_key('user:replies:'.$reply->profile_id));
19562 + $cache->delete(common_cache_key('user:replies:'.$reply->profile_id.';last'));
19570 hunk ./classes/Notice.php 263
19571 - function blowPublicCache($blowLast=false) {
19572 - if ($this->is_local == 1) {
19573 - $cache = common_memcache();
19575 - $cache->delete(common_cache_key('public'));
19577 - $cache->delete(common_cache_key('public').';last');
19582 + function blowPublicCache($blowLast=false) {
19583 + if ($this->is_local == 1) {
19584 + $cache = common_memcache();
19586 + $cache->delete(common_cache_key('public'));
19588 + $cache->delete(common_cache_key('public').';last');
19593 hunk ./classes/Notice.php 275
19594 - function blowFavesCache($blowLast=false) {
19595 - $cache = common_memcache();
19597 - $fave = new Fave();
19598 - $fave->notice_id = $this->id;
19599 - if ($fave->find()) {
19600 - while ($fave->fetch()) {
19601 - $cache->delete(common_cache_key('user:faves:'.$fave->user_id));
19603 - $cache->delete(common_cache_key('user:faves:'.$fave->user_id.';last'));
19611 + function blowFavesCache($blowLast=false) {
19612 + $cache = common_memcache();
19614 + $fave = new Fave();
19615 + $fave->notice_id = $this->id;
19616 + if ($fave->find()) {
19617 + while ($fave->fetch()) {
19618 + $cache->delete(common_cache_key('user:faves:'.$fave->user_id));
19620 + $cache->delete(common_cache_key('user:faves:'.$fave->user_id.';last'));
19628 hunk ./classes/Notice.php 293
19629 - # XXX: too many args; we need to move to named params or even a separate
19630 - # class for notice streams
19631 + # XXX: too many args; we need to move to named params or even a separate
19632 + # class for notice streams
19633 hunk ./classes/Notice.php 296
19634 - static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=NULL, $since=NULL) {
19635 + static function getStream($qry, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $order=NULL, $since=NULL) {
19636 hunk ./classes/Notice.php 298
19637 - if (common_config('memcached', 'enabled')) {
19638 + if (common_config('memcached', 'enabled')) {
19639 hunk ./classes/Notice.php 300
19640 - # Skip the cache if this is a since, since_id or before_id qry
19641 - if ($since_id > 0 || $before_id > 0 || $since) {
19642 - return Notice::getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since);
19644 - return Notice::getCachedStream($qry, $cachekey, $offset, $limit, $order);
19647 + # Skip the cache if this is a since, since_id or before_id qry
19648 + if ($since_id > 0 || $before_id > 0 || $since) {
19649 + return Notice::getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since);
19651 + return Notice::getCachedStream($qry, $cachekey, $offset, $limit, $order);
19654 hunk ./classes/Notice.php 308
19655 - return Notice::getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since);
19657 + return Notice::getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since);
19659 hunk ./classes/Notice.php 311
19660 - static function getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since) {
19661 + static function getStreamDirect($qry, $offset, $limit, $since_id, $before_id, $order, $since) {
19662 hunk ./classes/Notice.php 313
19663 - $needAnd = FALSE;
19664 - $needWhere = TRUE;
19665 + $needAnd = FALSE;
19666 + $needWhere = TRUE;
19667 hunk ./classes/Notice.php 316
19668 - if (preg_match('/\bWHERE\b/i', $qry)) {
19669 - $needWhere = FALSE;
19672 + if (preg_match('/\bWHERE\b/i', $qry)) {
19673 + $needWhere = FALSE;
19676 hunk ./classes/Notice.php 321
19677 - if ($since_id > 0) {
19678 + if ($since_id > 0) {
19679 hunk ./classes/Notice.php 323
19680 - if ($needWhere) {
19681 - $qry .= ' WHERE ';
19682 - $needWhere = FALSE;
19686 + if ($needWhere) {
19687 + $qry .= ' WHERE ';
19688 + $needWhere = FALSE;
19692 hunk ./classes/Notice.php 330
19693 - $qry .= ' notice.id > ' . $since_id;
19695 + $qry .= ' notice.id > ' . $since_id;
19697 hunk ./classes/Notice.php 333
19698 - if ($before_id > 0) {
19699 + if ($before_id > 0) {
19700 hunk ./classes/Notice.php 335
19701 - if ($needWhere) {
19702 - $qry .= ' WHERE ';
19703 - $needWhere = FALSE;
19707 + if ($needWhere) {
19708 + $qry .= ' WHERE ';
19709 + $needWhere = FALSE;
19713 hunk ./classes/Notice.php 342
19714 - $qry .= ' notice.id < ' . $before_id;
19716 + $qry .= ' notice.id < ' . $before_id;
19718 hunk ./classes/Notice.php 345
19721 hunk ./classes/Notice.php 347
19722 - if ($needWhere) {
19723 - $qry .= ' WHERE ';
19724 - $needWhere = FALSE;
19728 + if ($needWhere) {
19729 + $qry .= ' WHERE ';
19730 + $needWhere = FALSE;
19734 hunk ./classes/Notice.php 354
19735 - $qry .= ' notice.created > \'' . date('Y-m-d H:i:s', $since) . '\'';
19737 + $qry .= ' notice.created > \'' . date('Y-m-d H:i:s', $since) . '\'';
19739 hunk ./classes/Notice.php 357
19740 - # Allow ORDER override
19741 + # Allow ORDER override
19742 hunk ./classes/Notice.php 359
19746 - $qry .= ' ORDER BY notice.created DESC, notice.id DESC ';
19751 + $qry .= ' ORDER BY notice.created DESC, notice.id DESC ';
19753 hunk ./classes/Notice.php 365
19754 - if (common_config('db','type') == 'pgsql') {
19755 - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
19757 - $qry .= ' LIMIT ' . $offset . ', ' . $limit;
19759 + if (common_config('db','type') == 'pgsql') {
19760 + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
19762 + $qry .= ' LIMIT ' . $offset . ', ' . $limit;
19764 hunk ./classes/Notice.php 371
19765 - $notice = new Notice();
19766 + $notice = new Notice();
19767 hunk ./classes/Notice.php 373
19768 - $notice->query($qry);
19769 + $notice->query($qry);
19770 hunk ./classes/Notice.php 375
19775 hunk ./classes/Notice.php 378
19776 - # XXX: this is pretty long and should probably be broken up into
19777 - # some helper functions
19778 + # XXX: this is pretty long and should probably be broken up into
19779 + # some helper functions
19780 hunk ./classes/Notice.php 381
19781 - static function getCachedStream($qry, $cachekey, $offset, $limit, $order) {
19782 + static function getCachedStream($qry, $cachekey, $offset, $limit, $order) {
19783 hunk ./classes/Notice.php 383
19784 - # If outside our cache window, just go to the DB
19785 + # If outside our cache window, just go to the DB
19786 hunk ./classes/Notice.php 385
19787 - if ($offset + $limit > NOTICE_CACHE_WINDOW) {
19788 - return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
19790 + if ($offset + $limit > NOTICE_CACHE_WINDOW) {
19791 + return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
19793 hunk ./classes/Notice.php 389
19794 - # Get the cache; if we can't, just go to the DB
19795 + # Get the cache; if we can't, just go to the DB
19796 hunk ./classes/Notice.php 391
19797 - $cache = common_memcache();
19798 + $cache = common_memcache();
19799 hunk ./classes/Notice.php 393
19801 - return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
19804 + return Notice::getStreamDirect($qry, $offset, $limit, NULL, NULL, $order, NULL);
19806 hunk ./classes/Notice.php 397
19807 - # Get the notices out of the cache
19808 + # Get the notices out of the cache
19809 hunk ./classes/Notice.php 399
19810 - $notices = $cache->get(common_cache_key($cachekey));
19811 + $notices = $cache->get(common_cache_key($cachekey));
19812 hunk ./classes/Notice.php 401
19813 - # On a cache hit, return a DB-object-like wrapper
19814 + # On a cache hit, return a DB-object-like wrapper
19815 hunk ./classes/Notice.php 403
19816 - if ($notices !== FALSE) {
19817 - $wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
19820 + if ($notices !== FALSE) {
19821 + $wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
19824 hunk ./classes/Notice.php 408
19825 - # If the cache was invalidated because of new data being
19826 - # added, we can try and just get the new stuff. We keep an additional
19827 - # copy of the data at the key + ';last'
19828 + # If the cache was invalidated because of new data being
19829 + # added, we can try and just get the new stuff. We keep an additional
19830 + # copy of the data at the key + ';last'
19831 hunk ./classes/Notice.php 412
19832 - # No cache hit. Try to get the *last* cached version
19833 + # No cache hit. Try to get the *last* cached version
19834 hunk ./classes/Notice.php 414
19835 - $last_notices = $cache->get(common_cache_key($cachekey) . ';last');
19836 + $last_notices = $cache->get(common_cache_key($cachekey) . ';last');
19837 hunk ./classes/Notice.php 416
19838 - if ($last_notices) {
19839 + if ($last_notices) {
19840 hunk ./classes/Notice.php 418
19841 - # Reverse-chron order, so last ID is last.
19842 + # Reverse-chron order, so last ID is last.
19843 hunk ./classes/Notice.php 420
19844 - $last_id = $last_notices[0]->id;
19845 + $last_id = $last_notices[0]->id;
19846 hunk ./classes/Notice.php 422
19847 - # XXX: this assumes monotonically increasing IDs; a fair
19848 - # bet with our DB.
19849 + # XXX: this assumes monotonically increasing IDs; a fair
19850 + # bet with our DB.
19851 hunk ./classes/Notice.php 425
19852 - $new_notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW,
19853 - $last_id, NULL, $order, NULL);
19854 + $new_notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW,
19855 + $last_id, NULL, $order, NULL);
19856 hunk ./classes/Notice.php 428
19857 - if ($new_notice) {
19858 - $new_notices = array();
19859 - while ($new_notice->fetch()) {
19860 - $new_notices[] = clone($new_notice);
19862 - $new_notice->free();
19863 - $notices = array_slice(array_merge($new_notices, $last_notices),
19864 - 0, NOTICE_CACHE_WINDOW);
19865 + if ($new_notice) {
19866 + $new_notices = array();
19867 + while ($new_notice->fetch()) {
19868 + $new_notices[] = clone($new_notice);
19870 + $new_notice->free();
19871 + $notices = array_slice(array_merge($new_notices, $last_notices),
19872 + 0, NOTICE_CACHE_WINDOW);
19873 hunk ./classes/Notice.php 437
19874 - # Store the array in the cache for next time
19875 + # Store the array in the cache for next time
19876 hunk ./classes/Notice.php 439
19877 - $result = $cache->set(common_cache_key($cachekey), $notices);
19878 - $result = $cache->set(common_cache_key($cachekey) . ';last', $notices);
19879 + $result = $cache->set(common_cache_key($cachekey), $notices);
19880 + $result = $cache->set(common_cache_key($cachekey) . ';last', $notices);
19881 hunk ./classes/Notice.php 442
19882 - # return a wrapper of the array for use now
19883 + # return a wrapper of the array for use now
19884 hunk ./classes/Notice.php 444
19885 - return new NoticeWrapper(array_slice($notices, $offset, $limit));
19888 + return new NoticeWrapper(array_slice($notices, $offset, $limit));
19891 hunk ./classes/Notice.php 448
19892 - # Otherwise, get the full cache window out of the DB
19893 + # Otherwise, get the full cache window out of the DB
19894 hunk ./classes/Notice.php 450
19895 - $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, NULL, NULL, $order, NULL);
19896 + $notice = Notice::getStreamDirect($qry, 0, NOTICE_CACHE_WINDOW, NULL, NULL, $order, NULL);
19897 hunk ./classes/Notice.php 452
19898 - # If there are no hits, just return the value
19899 + # If there are no hits, just return the value
19900 hunk ./classes/Notice.php 454
19907 hunk ./classes/Notice.php 458
19908 - # Pack results into an array
19909 + # Pack results into an array
19910 hunk ./classes/Notice.php 460
19911 - $notices = array();
19912 + $notices = array();
19913 hunk ./classes/Notice.php 462
19914 - while ($notice->fetch()) {
19915 - $notices[] = clone($notice);
19917 + while ($notice->fetch()) {
19918 + $notices[] = clone($notice);
19920 hunk ./classes/Notice.php 466
19923 hunk ./classes/Notice.php 468
19924 - # Store the array in the cache for next time
19925 + # Store the array in the cache for next time
19926 hunk ./classes/Notice.php 470
19927 - $result = $cache->set(common_cache_key($cachekey), $notices);
19928 - $result = $cache->set(common_cache_key($cachekey) . ';last', $notices);
19929 + $result = $cache->set(common_cache_key($cachekey), $notices);
19930 + $result = $cache->set(common_cache_key($cachekey) . ';last', $notices);
19931 hunk ./classes/Notice.php 473
19932 - # return a wrapper of the array for use now
19933 + # return a wrapper of the array for use now
19934 hunk ./classes/Notice.php 475
19935 - $wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
19936 + $wrapper = new NoticeWrapper(array_slice($notices, $offset, $limit));
19937 hunk ./classes/Notice.php 477
19942 hunk ./classes/Notice.php 480
19943 - function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=NULL) {
19944 + function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=NULL) {
19945 hunk ./classes/Notice.php 482
19946 - $parts = array();
19947 + $parts = array();
19948 hunk ./classes/Notice.php 484
19949 - $qry = 'SELECT * FROM notice ';
19950 + $qry = 'SELECT * FROM notice ';
19951 hunk ./classes/Notice.php 486
19952 - if (common_config('public', 'localonly')) {
19953 - $parts[] = 'is_local = 1';
19955 - # -1 == blacklisted
19956 - $parts[] = 'is_local != -1';
19958 + if (common_config('public', 'localonly')) {
19959 + $parts[] = 'is_local = 1';
19961 + # -1 == blacklisted
19962 + $parts[] = 'is_local != -1';
19964 hunk ./classes/Notice.php 493
19966 - $qry .= ' WHERE ' . implode(' AND ', $parts);
19969 + $qry .= ' WHERE ' . implode(' AND ', $parts);
19971 hunk ./classes/Notice.php 497
19972 - return Notice::getStream($qry,
19974 - $offset, $limit, $since_id, $before_id, NULL, $since);
19976 + return Notice::getStream($qry,
19978 + $offset, $limit, $since_id, $before_id, NULL, $since);
19980 hunk ./classes/Notice.php 502
19981 - function addToInboxes() {
19982 - $enabled = common_config('inboxes', 'enabled');
19983 + function addToInboxes() {
19984 + $enabled = common_config('inboxes', 'enabled');
19985 hunk ./classes/Notice.php 505
19986 - if ($enabled === true || $enabled === 'transitional') {
19987 - $inbox = new Notice_inbox();
19988 - $qry = 'INSERT INTO notice_inbox (user_id, notice_id, created) ' .
19989 - 'SELECT user.id, ' . $this->id . ', "' . $this->created . '" ' .
19990 - 'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
19991 - 'WHERE subscription.subscribed = ' . $this->profile_id . ' ' .
19992 - 'AND NOT EXISTS (SELECT user_id, notice_id ' .
19993 - 'FROM notice_inbox ' .
19994 - 'WHERE user_id = user.id ' .
19995 - 'AND notice_id = ' . $this->id . ' )';
19996 - if ($enabled === 'transitional') {
19997 - $qry .= ' AND user.inboxed = 1';
19999 - $inbox->query($qry);
20003 + if ($enabled === true || $enabled === 'transitional') {
20004 + $inbox = new Notice_inbox();
20005 + $qry = 'INSERT INTO notice_inbox (user_id, notice_id, created) ' .
20006 + 'SELECT user.id, ' . $this->id . ', "' . $this->created . '" ' .
20007 + 'FROM user JOIN subscription ON user.id = subscription.subscriber ' .
20008 + 'WHERE subscription.subscribed = ' . $this->profile_id . ' ' .
20009 + 'AND NOT EXISTS (SELECT user_id, notice_id ' .
20010 + 'FROM notice_inbox ' .
20011 + 'WHERE user_id = user.id ' .
20012 + 'AND notice_id = ' . $this->id . ' )';
20013 + if ($enabled === 'transitional') {
20014 + $qry .= ' AND user.inboxed = 1';
20016 + $inbox->query($qry);
20020 hunk ./classes/Notice.php 523
20021 - # Delete from inboxes if we're deleted.
20022 + # Delete from inboxes if we're deleted.
20023 hunk ./classes/Notice.php 525
20024 - function blowInboxes() {
20025 + function blowInboxes() {
20026 hunk ./classes/Notice.php 527
20027 - $enabled = common_config('inboxes', 'enabled');
20028 + $enabled = common_config('inboxes', 'enabled');
20029 hunk ./classes/Notice.php 529
20030 - if ($enabled === true || $enabled === 'transitional') {
20031 - $inbox = new Notice_inbox();
20032 - $inbox->notice_id = $this->id;
20033 - $inbox->delete();
20035 + if ($enabled === true || $enabled === 'transitional') {
20036 + $inbox = new Notice_inbox();
20037 + $inbox->notice_id = $this->id;
20038 + $inbox->delete();
20040 hunk ./classes/Notice.php 535
20045 hunk ./classes/NoticeWrapper.php 38
20046 - var $notices = NULL;
20049 - function __construct($arr) {
20050 - $this->notices = $arr;
20053 - function fetch() {
20054 - static $fields = array('id', 'profile_id', 'uri', 'content', 'rendered',
20055 - 'url', 'created', 'modified', 'reply_to', 'is_local', 'source');
20057 - if ($this->i >= count($this->notices)) {
20060 - $n = $this->notices[$this->i];
20061 - foreach ($fields as $f) {
20062 - $this->$f = $n->$f;
20067 + var $notices = NULL;
20070 + function __construct($arr) {
20071 + $this->notices = $arr;
20074 + function fetch() {
20075 + static $fields = array('id', 'profile_id', 'uri', 'content', 'rendered',
20076 + 'url', 'created', 'modified', 'reply_to', 'is_local', 'source');
20078 + if ($this->i >= count($this->notices)) {
20081 + $n = $this->notices[$this->i];
20082 + foreach ($fields as $f) {
20083 + $this->$f = $n->$f;
20088 hunk ./classes/Notice_tag.php 37
20090 - static function getStream($tag, $offset=0, $limit=20) {
20092 - 'SELECT notice.* ' .
20093 - 'FROM notice JOIN notice_tag ON notice.id = notice_tag.notice_id ' .
20094 - 'WHERE notice_tag.tag = "%s" ';
20096 + static function getStream($tag, $offset=0, $limit=20) {
20098 + 'SELECT notice.* ' .
20099 + 'FROM notice JOIN notice_tag ON notice.id = notice_tag.notice_id ' .
20100 + 'WHERE notice_tag.tag = "%s" ';
20101 hunk ./classes/Notice_tag.php 44
20102 - return Notice::getStream(sprintf($qry, $tag),
20103 - 'notice_tag:notice_stream:' . common_keyize($tag),
20104 - $offset, $limit);
20107 - function blowCache() {
20108 - $cache = common_memcache();
20110 - $cache->delete(common_cache_key('notice_tag:notice_stream:' . $this->tag));
20113 + return Notice::getStream(sprintf($qry, $tag),
20114 + 'notice_tag:notice_stream:' . common_keyize($tag),
20115 + $offset, $limit);
20118 + function blowCache() {
20119 + $cache = common_memcache();
20121 + $cache->delete(common_cache_key('notice_tag:notice_stream:' . $this->tag));
20124 hunk ./classes/Profile.php 49
20125 - function getAvatar($width, $height=NULL) {
20126 - if (is_null($height)) {
20127 - $height = $width;
20129 - return Avatar::pkeyGet(array('profile_id' => $this->id,
20130 - 'width' => $width,
20131 - 'height' => $height));
20133 + function getAvatar($width, $height=NULL) {
20134 + if (is_null($height)) {
20135 + $height = $width;
20137 + return Avatar::pkeyGet(array('profile_id' => $this->id,
20138 + 'width' => $width,
20139 + 'height' => $height));
20141 hunk ./classes/Profile.php 58
20142 - function getOriginalAvatar() {
20143 - $avatar = DB_DataObject::factory('avatar');
20144 - $avatar->profile_id = $this->id;
20145 - $avatar->original = true;
20146 - if ($avatar->find(true)) {
20152 + function getOriginalAvatar() {
20153 + $avatar = DB_DataObject::factory('avatar');
20154 + $avatar->profile_id = $this->id;
20155 + $avatar->original = true;
20156 + if ($avatar->find(true)) {
20162 hunk ./classes/Profile.php 69
20163 - function setOriginal($source) {
20164 + function setOriginal($source) {
20165 hunk ./classes/Profile.php 71
20166 - $info = @getimagesize($source);
20167 + $info = @getimagesize($source);
20168 hunk ./classes/Profile.php 73
20175 hunk ./classes/Profile.php 77
20176 - $filename = common_avatar_filename($this->id,
20177 - image_type_to_extension($info[2]),
20178 - NULL, common_timestamp());
20179 - $filepath = common_avatar_path($filename);
20180 + $filename = common_avatar_filename($this->id,
20181 + image_type_to_extension($info[2]),
20182 + NULL, common_timestamp());
20183 + $filepath = common_avatar_path($filename);
20184 hunk ./classes/Profile.php 82
20185 - copy($source, $filepath);
20186 + copy($source, $filepath);
20187 hunk ./classes/Profile.php 84
20188 - $avatar = new Avatar();
20189 + $avatar = new Avatar();
20190 hunk ./classes/Profile.php 86
20191 - $avatar->profile_id = $this->id;
20192 - $avatar->width = $info[0];
20193 - $avatar->height = $info[1];
20194 - $avatar->mediatype = image_type_to_mime_type($info[2]);
20195 - $avatar->filename = $filename;
20196 - $avatar->original = true;
20197 - $avatar->url = common_avatar_url($filename);
20198 - $avatar->created = DB_DataObject_Cast::dateTime(); # current time
20199 + $avatar->profile_id = $this->id;
20200 + $avatar->width = $info[0];
20201 + $avatar->height = $info[1];
20202 + $avatar->mediatype = image_type_to_mime_type($info[2]);
20203 + $avatar->filename = $filename;
20204 + $avatar->original = true;
20205 + $avatar->url = common_avatar_url($filename);
20206 + $avatar->created = DB_DataObject_Cast::dateTime(); # current time
20207 hunk ./classes/Profile.php 95
20208 - # XXX: start a transaction here
20209 + # XXX: start a transaction here
20210 hunk ./classes/Profile.php 97
20211 - if (!$this->delete_avatars()) {
20212 - @unlink($filepath);
20215 + if (!$this->delete_avatars()) {
20216 + @unlink($filepath);
20219 hunk ./classes/Profile.php 102
20220 - if (!$avatar->insert()) {
20221 - @unlink($filepath);
20224 + if (!$avatar->insert()) {
20225 + @unlink($filepath);
20228 hunk ./classes/Profile.php 107
20229 - foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
20230 - # We don't do a scaled one if original is our scaled size
20231 - if (!($avatar->width == $size && $avatar->height == $size)) {
20232 - $s = $avatar->scale($size);
20238 + foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
20239 + # We don't do a scaled one if original is our scaled size
20240 + if (!($avatar->width == $size && $avatar->height == $size)) {
20241 + $s = $avatar->scale($size);
20247 hunk ./classes/Profile.php 117
20252 hunk ./classes/Profile.php 120
20253 - function delete_avatars() {
20254 - $avatar = new Avatar();
20255 - $avatar->profile_id = $this->id;
20257 - while ($avatar->fetch()) {
20258 - $avatar->delete();
20262 + function delete_avatars() {
20263 + $avatar = new Avatar();
20264 + $avatar->profile_id = $this->id;
20266 + while ($avatar->fetch()) {
20267 + $avatar->delete();
20271 hunk ./classes/Profile.php 130
20272 - function getBestName() {
20273 - return ($this->fullname) ? $this->fullname : $this->nickname;
20275 + function getBestName() {
20276 + return ($this->fullname) ? $this->fullname : $this->nickname;
20278 hunk ./classes/Profile.php 135
20279 - function getCurrentNotice($dt=NULL) {
20280 - $notice = new Notice();
20281 - $notice->profile_id = $this->id;
20283 - $notice->whereAdd('created < "' . $dt . '"');
20285 - $notice->orderBy('created DESC, notice.id DESC');
20286 - $notice->limit(1);
20287 - if ($notice->find(true)) {
20292 + function getCurrentNotice($dt=NULL) {
20293 + $notice = new Notice();
20294 + $notice->profile_id = $this->id;
20296 + $notice->whereAdd('created < "' . $dt . '"');
20298 + $notice->orderBy('created DESC, notice.id DESC');
20299 + $notice->limit(1);
20300 + if ($notice->find(true)) {
20305 hunk ./classes/Profile.php 149
20306 - function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
20310 - 'WHERE profile_id = %d ';
20311 + function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
20315 + 'WHERE profile_id = %d ';
20316 hunk ./classes/Profile.php 155
20317 - return Notice::getStream(sprintf($qry, $this->id),
20318 - 'profile:notices:'.$this->id,
20319 - $offset, $limit, $since_id, $before_id);
20321 + return Notice::getStream(sprintf($qry, $this->id),
20322 + 'profile:notices:'.$this->id,
20323 + $offset, $limit, $since_id, $before_id);
20325 hunk ./classes/Profile_tag.php 24
20326 - static function getTags($tagger, $tagged) {
20329 + static function getTags($tagger, $tagged) {
20332 hunk ./classes/Profile_tag.php 28
20333 - # XXX: store this in memcached
20335 - $profile_tag = new Profile_tag();
20336 - $profile_tag->tagger = $tagger;
20337 - $profile_tag->tagged = $tagged;
20339 - $profile_tag->find();
20341 - while ($profile_tag->fetch()) {
20342 - $tags[] = $profile_tag->tag;
20345 - $profile_tag->free();
20350 - static function setTags($tagger, $tagged, $newtags) {
20352 - $oldtags = Profile_tag::getTags($tagger, $tagged);
20354 - # Delete stuff that's old that not in new
20356 - $to_delete = array_diff($oldtags, $newtags);
20358 - # Insert stuff that's in new and not in old
20360 - $to_insert = array_diff($newtags, $oldtags);
20362 - $profile_tag = new Profile_tag();
20364 - $profile_tag->tagger = $tagger;
20365 - $profile_tag->tagged = $tagged;
20367 - $profile_tag->query('BEGIN');
20369 - foreach ($to_delete as $deltag) {
20370 - $profile_tag->tag = $deltag;
20371 - $result = $profile_tag->delete();
20373 - common_log_db_error($profile_tag, 'DELETE', __FILE__);
20378 - foreach ($to_insert as $instag) {
20379 - $profile_tag->tag = $instag;
20380 - $result = $profile_tag->insert();
20382 - common_log_db_error($profile_tag, 'INSERT', __FILE__);
20387 - $profile_tag->query('COMMIT');
20392 - # Return profiles with a given tag
20393 - static function getTagged($tagger, $tag) {
20394 - $profile = new Profile();
20395 - $profile->query('SELECT profile.* ' .
20396 - 'FROM profile JOIN profile_tag ' .
20397 - 'ON profile.id = profile_tag.tagged ' .
20398 - 'WHERE profile_tag.tagger = ' . $tagger . ' ' .
20399 - 'AND profile_tag.tag = "' . $tag . '" ');
20400 - $tagged = array();
20401 - while ($profile->fetch()) {
20402 - $tagged[] = clone($profile);
20406 + # XXX: store this in memcached
20408 + $profile_tag = new Profile_tag();
20409 + $profile_tag->tagger = $tagger;
20410 + $profile_tag->tagged = $tagged;
20412 + $profile_tag->find();
20414 + while ($profile_tag->fetch()) {
20415 + $tags[] = $profile_tag->tag;
20418 + $profile_tag->free();
20423 + static function setTags($tagger, $tagged, $newtags) {
20425 + $oldtags = Profile_tag::getTags($tagger, $tagged);
20427 + # Delete stuff that's old that not in new
20429 + $to_delete = array_diff($oldtags, $newtags);
20431 + # Insert stuff that's in new and not in old
20433 + $to_insert = array_diff($newtags, $oldtags);
20435 + $profile_tag = new Profile_tag();
20437 + $profile_tag->tagger = $tagger;
20438 + $profile_tag->tagged = $tagged;
20440 + $profile_tag->query('BEGIN');
20442 + foreach ($to_delete as $deltag) {
20443 + $profile_tag->tag = $deltag;
20444 + $result = $profile_tag->delete();
20446 + common_log_db_error($profile_tag, 'DELETE', __FILE__);
20451 + foreach ($to_insert as $instag) {
20452 + $profile_tag->tag = $instag;
20453 + $result = $profile_tag->insert();
20455 + common_log_db_error($profile_tag, 'INSERT', __FILE__);
20460 + $profile_tag->query('COMMIT');
20465 + # Return profiles with a given tag
20466 + static function getTagged($tagger, $tag) {
20467 + $profile = new Profile();
20468 + $profile->query('SELECT profile.* ' .
20469 + 'FROM profile JOIN profile_tag ' .
20470 + 'ON profile.id = profile_tag.tagged ' .
20471 + 'WHERE profile_tag.tagger = ' . $tagger . ' ' .
20472 + 'AND profile_tag.tag = "' . $tag . '" ');
20473 + $tagged = array();
20474 + while ($profile->fetch()) {
20475 + $tagged[] = clone($profile);
20479 hunk ./classes/Queue_item.php 25
20481 - static function top($transport) {
20483 + static function top($transport) {
20484 hunk ./classes/Queue_item.php 28
20485 - $qi = new Queue_item();
20486 - $qi->transport = $transport;
20487 - $qi->orderBy('created');
20488 - $qi->whereAdd('claimed is NULL');
20489 + $qi = new Queue_item();
20490 + $qi->transport = $transport;
20491 + $qi->orderBy('created');
20492 + $qi->whereAdd('claimed is NULL');
20493 hunk ./classes/Queue_item.php 33
20496 hunk ./classes/Queue_item.php 35
20497 - $cnt = $qi->find(TRUE);
20498 + $cnt = $qi->find(TRUE);
20499 hunk ./classes/Queue_item.php 37
20501 - # XXX: potential race condition
20502 - # can we force it to only update if claimed is still NULL
20504 - common_log(LOG_INFO, 'claiming queue item = ' . $qi->notice_id . ' for transport ' . $transport);
20505 - $orig = clone($qi);
20506 - $qi->claimed = common_sql_now();
20507 - $result = $qi->update($orig);
20509 - common_log(LOG_INFO, 'claim succeeded.');
20512 - common_log(LOG_INFO, 'claim failed.');
20519 + # XXX: potential race condition
20520 + # can we force it to only update if claimed is still NULL
20522 + common_log(LOG_INFO, 'claiming queue item = ' . $qi->notice_id . ' for transport ' . $transport);
20523 + $orig = clone($qi);
20524 + $qi->claimed = common_sql_now();
20525 + $result = $qi->update($orig);
20527 + common_log(LOG_INFO, 'claim succeeded.');
20530 + common_log(LOG_INFO, 'claim failed.');
20536 hunk ./classes/Sms_carrier.php 24
20538 - function toEmailAddress($sms) {
20539 - return sprintf($this->email_pattern, $sms);
20542 + function toEmailAddress($sms) {
20543 + return sprintf($this->email_pattern, $sms);
20545 hunk ./classes/Subscription.php 47
20547 - function &pkeyGet($kv) {
20548 - return Memcached_DataObject::pkeyGet('Subscription', $kv);
20551 + function &pkeyGet($kv) {
20552 + return Memcached_DataObject::pkeyGet('Subscription', $kv);
20554 hunk ./classes/User.php 70
20555 - function getProfile() {
20556 - return Profile::staticGet('id', $this->id);
20558 + function getProfile() {
20559 + return Profile::staticGet('id', $this->id);
20561 hunk ./classes/User.php 74
20562 - function isSubscribed($other) {
20563 - assert(!is_null($other));
20564 - # XXX: cache results of this query
20565 - $sub = Subscription::pkeyGet(array('subscriber' => $this->id,
20566 - 'subscribed' => $other->id));
20567 - return (is_null($sub)) ? false : true;
20569 + function isSubscribed($other) {
20570 + assert(!is_null($other));
20571 + # XXX: cache results of this query
20572 + $sub = Subscription::pkeyGet(array('subscriber' => $this->id,
20573 + 'subscribed' => $other->id));
20574 + return (is_null($sub)) ? false : true;
20576 hunk ./classes/User.php 82
20577 - # 'update' won't write key columns, so we have to do it ourselves.
20578 + # 'update' won't write key columns, so we have to do it ourselves.
20579 hunk ./classes/User.php 84
20580 - function updateKeys(&$orig) {
20581 - $parts = array();
20582 - foreach (array('nickname', 'email', 'jabber', 'incomingemail', 'sms', 'carrier', 'smsemail', 'language', 'timezone') as $k) {
20583 - if (strcmp($this->$k, $orig->$k) != 0) {
20584 - $parts[] = $k . ' = ' . $this->_quote($this->$k);
20587 - if (count($parts) == 0) {
20591 - $toupdate = implode(', ', $parts);
20592 + function updateKeys(&$orig) {
20593 + $parts = array();
20594 + foreach (array('nickname', 'email', 'jabber', 'incomingemail', 'sms', 'carrier', 'smsemail', 'language', 'timezone') as $k) {
20595 + if (strcmp($this->$k, $orig->$k) != 0) {
20596 + $parts[] = $k . ' = ' . $this->_quote($this->$k);
20599 + if (count($parts) == 0) {
20603 + $toupdate = implode(', ', $parts);
20604 hunk ./classes/User.php 97
20605 - $table = $this->tableName();
20606 - if(common_config('db','quote_identifiers')) {
20607 - $table = '"' . $table . '"';
20609 - $qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
20610 - ' WHERE id = ' . $this->id;
20611 - $orig->decache();
20612 - $result = $this->query($qry);
20614 - $this->encache();
20618 + $table = $this->tableName();
20619 + if(common_config('db','quote_identifiers')) {
20620 + $table = '"' . $table . '"';
20622 + $qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
20623 + ' WHERE id = ' . $this->id;
20624 + $orig->decache();
20625 + $result = $this->query($qry);
20627 + $this->encache();
20631 hunk ./classes/User.php 111
20632 - function allowed_nickname($nickname) {
20633 - # XXX: should already be validated for size, content, etc.
20634 - static $blacklist = array('rss', 'xrds', 'doc', 'main',
20635 - 'settings', 'notice', 'user',
20636 - 'search', 'avatar', 'tag', 'tags',
20637 - 'api', 'message');
20638 - $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
20639 - return !in_array($nickname, $merged);
20641 + function allowed_nickname($nickname) {
20642 + # XXX: should already be validated for size, content, etc.
20643 + static $blacklist = array('rss', 'xrds', 'doc', 'main',
20644 + 'settings', 'notice', 'user',
20645 + 'search', 'avatar', 'tag', 'tags',
20646 + 'api', 'message');
20647 + $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
20648 + return !in_array($nickname, $merged);
20650 hunk ./classes/User.php 121
20651 - function getCurrentNotice($dt=NULL) {
20652 - $profile = $this->getProfile();
20656 - return $profile->getCurrentNotice($dt);
20658 + function getCurrentNotice($dt=NULL) {
20659 + $profile = $this->getProfile();
20663 + return $profile->getCurrentNotice($dt);
20665 hunk ./classes/User.php 129
20666 - function getCarrier() {
20667 - return Sms_carrier::staticGet('id', $this->carrier);
20669 + function getCarrier() {
20670 + return Sms_carrier::staticGet('id', $this->carrier);
20672 hunk ./classes/User.php 133
20673 - function subscribeTo($other) {
20674 - $sub = new Subscription();
20675 - $sub->subscriber = $this->id;
20676 - $sub->subscribed = $other->id;
20677 + function subscribeTo($other) {
20678 + $sub = new Subscription();
20679 + $sub->subscriber = $this->id;
20680 + $sub->subscribed = $other->id;
20681 hunk ./classes/User.php 138
20682 - $sub->created = common_sql_now(); # current time
20683 + $sub->created = common_sql_now(); # current time
20684 hunk ./classes/User.php 140
20685 - if (!$sub->insert()) {
20688 + if (!$sub->insert()) {
20691 hunk ./classes/User.php 144
20696 hunk ./classes/User.php 161
20697 - static function register($fields) {
20698 + static function register($fields) {
20699 hunk ./classes/User.php 163
20700 - # MAGICALLY put fields into current scope
20701 + # MAGICALLY put fields into current scope
20702 hunk ./classes/User.php 165
20703 - extract($fields);
20704 + extract($fields);
20705 hunk ./classes/User.php 167
20706 - $profile = new Profile();
20707 + $profile = new Profile();
20708 hunk ./classes/User.php 169
20709 - $profile->query('BEGIN');
20710 + $profile->query('BEGIN');
20711 hunk ./classes/User.php 171
20712 - $profile->nickname = $nickname;
20713 - $profile->profileurl = common_profile_url($nickname);
20714 + $profile->nickname = $nickname;
20715 + $profile->profileurl = common_profile_url($nickname);
20716 hunk ./classes/User.php 174
20718 - $profile->fullname = $fullname;
20721 - $profile->homepage = $homepage;
20724 - $profile->bio = $bio;
20727 - $profile->location = $location;
20730 + $profile->fullname = $fullname;
20733 + $profile->homepage = $homepage;
20736 + $profile->bio = $bio;
20739 + $profile->location = $location;
20741 hunk ./classes/User.php 187
20742 - $profile->created = common_sql_now();
20743 + $profile->created = common_sql_now();
20744 hunk ./classes/User.php 189
20745 - $id = $profile->insert();
20746 + $id = $profile->insert();
20747 hunk ./classes/User.php 191
20749 - common_log_db_error($profile, 'INSERT', __FILE__);
20753 + common_log_db_error($profile, 'INSERT', __FILE__);
20756 hunk ./classes/User.php 196
20757 - $user = new User();
20758 + $user = new User();
20759 hunk ./classes/User.php 198
20761 - $user->nickname = $nickname;
20763 + $user->nickname = $nickname;
20764 hunk ./classes/User.php 201
20765 - if ($password) { # may not have a password for OpenID users
20766 - $user->password = common_munge_password($password, $id);
20768 + if ($password) { # may not have a password for OpenID users
20769 + $user->password = common_munge_password($password, $id);
20771 hunk ./classes/User.php 205
20772 - # Users who respond to invite email have proven their ownership of that address
20773 + # Users who respond to invite email have proven their ownership of that address
20774 hunk ./classes/User.php 207
20776 - $invite = Invitation::staticGet($code);
20777 - if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
20778 - $user->email = $invite->address;
20782 + $invite = Invitation::staticGet($code);
20783 + if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
20784 + $user->email = $invite->address;
20787 hunk ./classes/User.php 214
20788 - $inboxes = common_config('inboxes', 'enabled');
20789 + $inboxes = common_config('inboxes', 'enabled');
20790 hunk ./classes/User.php 216
20791 - if ($inboxes === true || $inboxes == 'transitional') {
20792 - $user->inboxed = 1;
20794 + if ($inboxes === true || $inboxes == 'transitional') {
20795 + $user->inboxed = 1;
20797 hunk ./classes/User.php 220
20798 - $user->created = common_sql_now();
20799 - $user->uri = common_user_uri($user);
20800 + $user->created = common_sql_now();
20801 + $user->uri = common_user_uri($user);
20802 hunk ./classes/User.php 223
20803 - $result = $user->insert();
20804 + $result = $user->insert();
20805 hunk ./classes/User.php 225
20807 - common_log_db_error($user, 'INSERT', __FILE__);
20811 + common_log_db_error($user, 'INSERT', __FILE__);
20814 hunk ./classes/User.php 230
20815 - # Everyone is subscribed to themself
20816 + # Everyone is subscribed to themself
20817 hunk ./classes/User.php 232
20818 - $subscription = new Subscription();
20819 - $subscription->subscriber = $user->id;
20820 - $subscription->subscribed = $user->id;
20821 - $subscription->created = $user->created;
20822 + $subscription = new Subscription();
20823 + $subscription->subscriber = $user->id;
20824 + $subscription->subscribed = $user->id;
20825 + $subscription->created = $user->created;
20826 hunk ./classes/User.php 237
20827 - $result = $subscription->insert();
20828 + $result = $subscription->insert();
20829 hunk ./classes/User.php 239
20831 - common_log_db_error($subscription, 'INSERT', __FILE__);
20835 + common_log_db_error($subscription, 'INSERT', __FILE__);
20838 hunk ./classes/User.php 244
20839 - if ($email && !$user->email) {
20840 + if ($email && !$user->email) {
20841 hunk ./classes/User.php 246
20842 - $confirm = new Confirm_address();
20843 - $confirm->code = common_confirmation_code(128);
20844 - $confirm->user_id = $user->id;
20845 - $confirm->address = $email;
20846 - $confirm->address_type = 'email';
20847 + $confirm = new Confirm_address();
20848 + $confirm->code = common_confirmation_code(128);
20849 + $confirm->user_id = $user->id;
20850 + $confirm->address = $email;
20851 + $confirm->address_type = 'email';
20852 hunk ./classes/User.php 252
20853 - $result = $confirm->insert();
20855 - common_log_db_error($confirm, 'INSERT', __FILE__);
20859 + $result = $confirm->insert();
20861 + common_log_db_error($confirm, 'INSERT', __FILE__);
20865 hunk ./classes/User.php 259
20866 - if ($code && $user->email) {
20867 - $user->emailChanged();
20869 + if ($code && $user->email) {
20870 + $user->emailChanged();
20872 hunk ./classes/User.php 263
20873 - $profile->query('COMMIT');
20874 + $profile->query('COMMIT');
20875 hunk ./classes/User.php 265
20876 - if ($email && !$user->email) {
20877 - mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
20879 + if ($email && !$user->email) {
20880 + mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
20882 hunk ./classes/User.php 269
20887 hunk ./classes/User.php 272
20888 - # Things we do when the email changes
20889 + # Things we do when the email changes
20890 hunk ./classes/User.php 274
20891 - function emailChanged() {
20892 + function emailChanged() {
20893 hunk ./classes/User.php 276
20894 - $invites = new Invitation();
20895 - $invites->address = $this->email;
20896 - $invites->address_type = 'email';
20897 + $invites = new Invitation();
20898 + $invites->address = $this->email;
20899 + $invites->address_type = 'email';
20900 hunk ./classes/User.php 280
20901 - if ($invites->find()) {
20902 - while ($invites->fetch()) {
20903 - $other = User::staticGet($invites->user_id);
20904 - subs_subscribe_to($other, $this);
20908 + if ($invites->find()) {
20909 + while ($invites->fetch()) {
20910 + $other = User::staticGet($invites->user_id);
20911 + subs_subscribe_to($other, $this);
20915 hunk ./classes/User.php 288
20916 - function hasFave($notice) {
20917 - $cache = common_memcache();
20918 + function hasFave($notice) {
20919 + $cache = common_memcache();
20920 hunk ./classes/User.php 291
20921 - # XXX: Kind of a hack.
20923 - # This is the stream of favorite notices, in rev chron
20924 - # order. This forces it into cache.
20925 - $faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW);
20927 - while ($faves->fetch()) {
20928 - if ($faves->id < $notice->id) {
20929 - # If we passed it, it's not a fave
20931 - } else if ($faves->id == $notice->id) {
20932 - # If it matches a cached notice, then it's a fave
20937 - # If we're not past the end of the cache window,
20938 - # then the cache has all available faves, so this one
20940 - if ($cnt < NOTICE_CACHE_WINDOW) {
20943 - # Otherwise, cache doesn't have all faves;
20944 - # fall through to the default
20946 - $fave = Fave::pkeyGet(array('user_id' => $this->id,
20947 - 'notice_id' => $notice->id));
20948 - return ((is_null($fave)) ? false : true);
20950 - function mutuallySubscribed($other) {
20951 - return $this->isSubscribed($other) &&
20952 - $other->isSubscribed($this);
20954 + # XXX: Kind of a hack.
20956 + # This is the stream of favorite notices, in rev chron
20957 + # order. This forces it into cache.
20958 + $faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW);
20960 + while ($faves->fetch()) {
20961 + if ($faves->id < $notice->id) {
20962 + # If we passed it, it's not a fave
20964 + } else if ($faves->id == $notice->id) {
20965 + # If it matches a cached notice, then it's a fave
20970 + # If we're not past the end of the cache window,
20971 + # then the cache has all available faves, so this one
20973 + if ($cnt < NOTICE_CACHE_WINDOW) {
20976 + # Otherwise, cache doesn't have all faves;
20977 + # fall through to the default
20979 + $fave = Fave::pkeyGet(array('user_id' => $this->id,
20980 + 'notice_id' => $notice->id));
20981 + return ((is_null($fave)) ? false : true);
20983 + function mutuallySubscribed($other) {
20984 + return $this->isSubscribed($other) &&
20985 + $other->isSubscribed($this);
20987 hunk ./classes/User.php 327
20988 - # 3-way join; probably should get cached
20989 - $qry = 'SELECT user.* ' .
20990 - 'FROM subscription sub1 JOIN user ON sub1.subscribed = user.id ' .
20991 - 'JOIN subscription sub2 ON user.id = sub2.subscriber ' .
20992 - 'WHERE sub1.subscriber = %d and sub2.subscribed = %d ' .
20993 - 'ORDER BY user.nickname';
20994 - $user = new User();
20995 - $user->query(sprintf($qry, $this->id, $this->id));
20996 + # 3-way join; probably should get cached
20997 + $qry = 'SELECT user.* ' .
20998 + 'FROM subscription sub1 JOIN user ON sub1.subscribed = user.id ' .
20999 + 'JOIN subscription sub2 ON user.id = sub2.subscriber ' .
21000 + 'WHERE sub1.subscriber = %d and sub2.subscribed = %d ' .
21001 + 'ORDER BY user.nickname';
21002 + $user = new User();
21003 + $user->query(sprintf($qry, $this->id, $this->id));
21004 hunk ./classes/User.php 336
21009 hunk ./classes/User.php 339
21010 - function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
21012 - 'SELECT notice.* ' .
21013 - 'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
21014 - 'WHERE reply.profile_id = %d ';
21015 - return Notice::getStream(sprintf($qry, $this->id),
21016 - 'user:replies:'.$this->id,
21017 - $offset, $limit, $since_id, $before_id, NULL, $since);
21019 + function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
21021 + 'SELECT notice.* ' .
21022 + 'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
21023 + 'WHERE reply.profile_id = %d ';
21024 + return Notice::getStream(sprintf($qry, $this->id),
21025 + 'user:replies:'.$this->id,
21026 + $offset, $limit, $since_id, $before_id, NULL, $since);
21028 hunk ./classes/User.php 356
21031 hunk ./classes/User.php 359
21033 - 'SELECT notice.* ' .
21034 - 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
21035 - 'WHERE fave.user_id = %d ';
21036 - return Notice::getStream(sprintf($qry, $this->id),
21037 - 'user:faves:'.$this->id,
21038 - $offset, $limit);
21041 + 'SELECT notice.* ' .
21042 + 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
21043 + 'WHERE fave.user_id = %d ';
21044 + return Notice::getStream(sprintf($qry, $this->id),
21045 + 'user:faves:'.$this->id,
21046 + $offset, $limit);
21048 hunk ./classes/User.php 369
21049 - $enabled = common_config('inboxes', 'enabled');
21050 + $enabled = common_config('inboxes', 'enabled');
21051 hunk ./classes/User.php 371
21052 - # Complicated code, depending on whether we support inboxes yet
21053 - # XXX: make this go away when inboxes become mandatory
21054 + # Complicated code, depending on whether we support inboxes yet
21055 + # XXX: make this go away when inboxes become mandatory
21056 hunk ./classes/User.php 374
21057 - if ($enabled === false ||
21058 - ($enabled == 'transitional' && $this->inboxed == 0)) {
21060 - 'SELECT notice.* ' .
21061 - 'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
21062 - 'WHERE subscription.subscriber = %d ';
21064 - } else if ($enabled === true ||
21065 - ($enabled == 'transitional' && $this->inboxed == 1)) {
21066 + if ($enabled === false ||
21067 + ($enabled == 'transitional' && $this->inboxed == 0)) {
21069 + 'SELECT notice.* ' .
21070 + 'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
21071 + 'WHERE subscription.subscriber = %d ';
21073 + } else if ($enabled === true ||
21074 + ($enabled == 'transitional' && $this->inboxed == 1)) {
21075 hunk ./classes/User.php 384
21077 - 'SELECT notice.* ' .
21078 - 'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' .
21079 - 'WHERE notice_inbox.user_id = %d ';
21080 - # NOTE: we override ORDER
21081 - $order = 'ORDER BY notice_inbox.created DESC, notice_inbox.notice_id DESC ';
21083 - return Notice::getStream(sprintf($qry, $this->id),
21084 - 'user:notices_with_friends:' . $this->id,
21085 - $offset, $limit, $since_id, $before_id,
21089 + 'SELECT notice.* ' .
21090 + 'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' .
21091 + 'WHERE notice_inbox.user_id = %d ';
21092 + # NOTE: we override ORDER
21093 + $order = 'ORDER BY notice_inbox.created DESC, notice_inbox.notice_id DESC ';
21095 + return Notice::getStream(sprintf($qry, $this->id),
21096 + 'user:notices_with_friends:' . $this->id,
21097 + $offset, $limit, $since_id, $before_id,
21100 hunk ./classes/User.php 398
21101 - $cache = common_memcache();
21103 - # Faves don't happen chronologically, so we need to blow
21104 - # ;last cache, too
21105 - $cache->delete(common_cache_key('user:faves:'.$this->id));
21106 - $cache->delete(common_cache_key('user:faves:'.$this->id).';last');
21109 + $cache = common_memcache();
21111 + # Faves don't happen chronologically, so we need to blow
21112 + # ;last cache, too
21113 + $cache->delete(common_cache_key('user:faves:'.$this->id));
21114 + $cache->delete(common_cache_key('user:faves:'.$this->id).';last');
21117 hunk ./classes/User.php 408
21118 - return Profile_tag::getTags($this->id, $this->id);
21120 + return Profile_tag::getTags($this->id, $this->id);
21122 hunk ./classes/User.php 412
21123 - return Profile_tag::setTags($this->id, $this->id, $newtags);
21125 + return Profile_tag::setTags($this->id, $this->id, $newtags);
21127 hunk ./classes/User.php 437
21128 - $sub = Subscription::pkeyGet(array('subscriber' => $other->id,
21129 - 'subscribed' => $this->id));
21130 + $sub = Subscription::pkeyGet(array('subscriber' => $other->id,
21131 + 'subscribed' => $this->id));
21132 hunk ./lib/common.php 57
21133 - array('name' => 'Just another Laconica microblog',
21134 - 'server' => 'localhost',
21135 - 'theme' => 'default',
21137 - 'logfile' => NULL,
21138 - 'fancy' => false,
21139 - 'locale_path' => INSTALLDIR.'/locale',
21140 - 'language' => 'en_US',
21141 - 'languages' => get_all_languages(),
21143 - array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
21144 - 'broughtby' => NULL,
21145 - 'timezone' => 'UTC',
21146 - 'broughtbyurl' => NULL,
21147 - 'closed' => false,
21148 - 'inviteonly' => false,
21149 + array('name' => 'Just another Laconica microblog',
21150 + 'server' => 'localhost',
21151 + 'theme' => 'default',
21153 + 'logfile' => NULL,
21154 + 'fancy' => false,
21155 + 'locale_path' => INSTALLDIR.'/locale',
21156 + 'language' => 'en_US',
21157 + 'languages' => get_all_languages(),
21159 + array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
21160 + 'broughtby' => NULL,
21161 + 'timezone' => 'UTC',
21162 + 'broughtbyurl' => NULL,
21163 + 'closed' => false,
21164 + 'inviteonly' => false,
21165 hunk ./lib/common.php 74
21167 - array('appname' => 'laconica', # for syslog
21168 - 'priority' => 'debug'), # XXX: currently ignored
21170 - array('enabled' => false),
21172 - array('url' => 'http://creativecommons.org/licenses/by/3.0/',
21173 - 'title' => 'Creative Commons Attribution 3.0',
21174 - 'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
21176 - array('backend' => 'mail',
21177 - 'params' => NULL),
21179 - array('blacklist' => array(),
21180 - 'featured' => array()),
21182 - array('banned' => array()),
21184 - array('server' => NULL),
21186 - array('localonly' => true,
21187 - 'blacklist' => array()),
21189 - array('server' => NULL),
21192 + array('appname' => 'laconica', # for syslog
21193 + 'priority' => 'debug'), # XXX: currently ignored
21195 + array('enabled' => false),
21197 + array('url' => 'http://creativecommons.org/licenses/by/3.0/',
21198 + 'title' => 'Creative Commons Attribution 3.0',
21199 + 'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
21201 + array('backend' => 'mail',
21202 + 'params' => NULL),
21204 + array('blacklist' => array(),
21205 + 'featured' => array()),
21207 + array('banned' => array()),
21209 + array('server' => NULL),
21211 + array('localonly' => true,
21212 + 'blacklist' => array()),
21214 + array('server' => NULL),
21216 hunk ./lib/common.php 102
21218 - array('enabled' => false,
21219 - 'server' => 'INVALID SERVER',
21221 - 'user' => 'update',
21222 - 'encryption' => true,
21223 - 'resource' => 'uniquename',
21224 - 'password' => 'blahblahblah',
21225 - 'host' => NULL, # only set if != server
21226 - 'debug' => false, # print extra debug info
21227 - 'public' => array()), # JIDs of users who want to receive the public stream
21229 + array('enabled' => false,
21230 + 'server' => 'INVALID SERVER',
21232 + 'user' => 'update',
21233 + 'encryption' => true,
21234 + 'resource' => 'uniquename',
21235 + 'password' => 'blahblahblah',
21236 + 'host' => NULL, # only set if != server
21237 + 'debug' => false, # print extra debug info
21238 + 'public' => array()), # JIDs of users who want to receive the public stream
21239 hunk ./lib/common.php 117
21241 - array('dropoff' => 864000.0),
21243 - array('dropoff' => 864000.0),
21245 - array('piddir' => '/var/run',
21247 - 'group' => false),
21249 - array('source' => 'Laconica'), # source attribute for Twitter
21251 - array('enabled' => false,
21252 - 'server' => 'localhost',
21253 - 'port' => 11211),
21255 - array('enabled' => true), # on by default for new sites
21258 + array('dropoff' => 864000.0),
21260 + array('dropoff' => 864000.0),
21262 + array('piddir' => '/var/run',
21264 + 'group' => false),
21266 + array('source' => 'Laconica'), # source attribute for Twitter
21268 + array('enabled' => false,
21269 + 'server' => 'localhost',
21270 + 'port' => 11211),
21272 + array('enabled' => true), # on by default for new sites
21274 hunk ./lib/common.php 139
21275 - 'schema_location' => INSTALLDIR . '/classes',
21276 - 'class_location' => INSTALLDIR . '/classes',
21277 - 'require_prefix' => 'classes/',
21278 - 'class_prefix' => '',
21279 - 'mirror' => NULL,
21280 + 'schema_location' => INSTALLDIR . '/classes',
21281 + 'class_location' => INSTALLDIR . '/classes',
21282 + 'require_prefix' => 'classes/',
21283 + 'class_prefix' => '',
21284 + 'mirror' => NULL,
21285 hunk ./lib/common.php 145
21286 - 'quote_identifiers' => false,
21287 - 'type' => 'mysql' );
21288 + 'quote_identifiers' => false,
21289 + 'type' => 'mysql' );
21290 hunk ./lib/common.php 149
21291 - /* Work internally in UTC */
21292 - date_default_timezone_set('UTC');
21293 + /* Work internally in UTC */
21294 + date_default_timezone_set('UTC');
21295 hunk ./lib/common.php 167
21296 - if ($class == 'OAuthRequest') {
21297 - require_once('OAuth.php');
21298 - } else if (file_exists(INSTALLDIR.'/classes/' . $class . '.php')) {
21299 + if ($class == 'OAuthRequest') {
21300 + require_once('OAuth.php');
21301 + } else if (file_exists(INSTALLDIR.'/classes/' . $class . '.php')) {
21302 hunk ./lib/deleteaction.php 24
21303 - function handle($args) {
21304 - parent::handle($args);
21305 - $user = common_current_user();
21306 - $notice_id = $this->trimmed('notice');
21307 - $notice = Notice::staticGet($notice_id);
21309 - common_user_error(_('No such notice.'));
21312 + function handle($args) {
21313 + parent::handle($args);
21314 + $user = common_current_user();
21315 + $notice_id = $this->trimmed('notice');
21316 + $notice = Notice::staticGet($notice_id);
21318 + common_user_error(_('No such notice.'));
21321 hunk ./lib/deleteaction.php 34
21322 - $profile = $notice->getProfile();
21323 - $user_profile = $user->getProfile();
21324 + $profile = $notice->getProfile();
21325 + $user_profile = $user->getProfile();
21326 hunk ./lib/deleteaction.php 37
21327 - if (!common_logged_in()) {
21328 - common_user_error(_('Not logged in.'));
21330 - } else if ($notice->profile_id != $user_profile->id) {
21331 - common_user_error(_('Can\'t delete this notice.'));
21335 + if (!common_logged_in()) {
21336 + common_user_error(_('Not logged in.'));
21338 + } else if ($notice->profile_id != $user_profile->id) {
21339 + common_user_error(_('Can\'t delete this notice.'));
21343 hunk ./lib/deleteaction.php 46
21344 - function show_top($arr=NULL) {
21345 - $instr = $this->get_instructions();
21346 - $output = common_markup_to_html($instr);
21347 - common_element_start('div', 'instructions');
21348 - common_raw($output);
21349 - common_element_end('div');
21351 + function show_top($arr=NULL) {
21352 + $instr = $this->get_instructions();
21353 + $output = common_markup_to_html($instr);
21354 + common_element_start('div', 'instructions');
21355 + common_raw($output);
21356 + common_element_end('div');
21358 hunk ./lib/deleteaction.php 54
21359 - function get_title() {
21362 + function get_title() {
21365 hunk ./lib/deleteaction.php 58
21366 - function show_header() {
21369 + function show_header() {
21372 hunk ./lib/facebookaction.php 13
21373 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21374 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21375 hunk ./lib/facebookaction.php 17
21376 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
21377 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
21378 hunk ./lib/facebookaction.php 26
21379 - function handle($args) {
21380 - parent::handle($args);
21382 + function handle($args) {
21383 + parent::handle($args);
21385 hunk ./lib/facebookaction.php 30
21386 - function get_facebook() {
21387 - $apikey = common_config('facebook', 'apikey');
21388 - $secret = common_config('facebook', 'secret');
21389 - return new Facebook($apikey, $secret);
21391 + function get_facebook() {
21392 + $apikey = common_config('facebook', 'apikey');
21393 + $secret = common_config('facebook', 'secret');
21394 + return new Facebook($apikey, $secret);
21396 hunk ./lib/facebookaction.php 36
21397 - function update_profile_box($facebook, $fbuid, $user) {
21398 + function update_profile_box($facebook, $fbuid, $user) {
21399 hunk ./lib/facebookaction.php 38
21400 - $notice = $user->getCurrentNotice();
21401 + $notice = $user->getCurrentNotice();
21402 hunk ./lib/facebookaction.php 40
21403 - # Need to include inline CSS for styling the Profile box
21404 + # Need to include inline CSS for styling the Profile box
21405 hunk ./lib/facebookaction.php 42
21406 - $style = '<style>
21411 - list-style-type: none;
21413 - border-top: 1px solid #dec5b5;
21415 - #notices a:hover {
21416 - text-decoration: underline;
21422 - padding: 5px 5px 5px 0;
21423 - min-height: 48px;
21424 - font-family: Georgia, "Times New Roman", Times, serif;
21426 - line-height: 16px;
21427 - border-bottom: 1px solid #dec5b5;
21428 - background-color:#FCFFF5;
21431 - .notice_single:hover {
21432 - background-color: #f7ebcc;
21434 - .notice_single p {
21440 + $style = '<style>
21445 + list-style-type: none;
21447 + border-top: 1px solid #dec5b5;
21449 + #notices a:hover {
21450 + text-decoration: underline;
21456 + padding: 5px 5px 5px 0;
21457 + min-height: 48px;
21458 + font-family: Georgia, "Times New Roman", Times, serif;
21460 + line-height: 16px;
21461 + border-bottom: 1px solid #dec5b5;
21462 + background-color:#FCFFF5;
21465 + .notice_single:hover {
21466 + background-color: #f7ebcc;
21468 + .notice_single p {
21474 hunk ./lib/facebookaction.php 77
21475 - $html = $this->render_notice($notice);
21476 + $html = $this->render_notice($notice);
21477 hunk ./lib/facebookaction.php 79
21478 - $fbml = "<fb:wide>$content $html</fb:wide>";
21479 - $fbml .= "<fb:narrow>$content $html</fb:narrow>";
21480 + $fbml = "<fb:wide>$content $html</fb:wide>";
21481 + $fbml .= "<fb:narrow>$content $html</fb:narrow>";
21482 hunk ./lib/facebookaction.php 82
21483 - $fbml_main = "<fb:narrow>$content $html</fb:narrow>";
21484 + $fbml_main = "<fb:narrow>$content $html</fb:narrow>";
21485 hunk ./lib/facebookaction.php 84
21486 - $facebook->api_client->profile_setFBML(NULL, $fbuid, $fbml, NULL, NULL, $fbml_main);
21488 + $facebook->api_client->profile_setFBML(NULL, $fbuid, $fbml, NULL, NULL, $fbml_main);
21490 hunk ./lib/facebookaction.php 87
21491 - # Display methods
21492 + # Display methods
21493 hunk ./lib/facebookaction.php 89
21494 - function show_header($selected ='Home') {
21495 + function show_header($selected ='Home') {
21496 hunk ./lib/facebookaction.php 91
21497 - # Add a timestamp to the CSS file so Facebook cache wont ignore our changes
21498 - $ts = filemtime(theme_file('facebookapp.css'));
21499 - $cssurl = theme_path('facebookapp.css') . "?ts=$ts";
21500 + # Add a timestamp to the CSS file so Facebook cache wont ignore our changes
21501 + $ts = filemtime(theme_file('facebookapp.css'));
21502 + $cssurl = theme_path('facebookapp.css') . "?ts=$ts";
21503 hunk ./lib/facebookaction.php 95
21504 - $header = '<link rel="stylesheet" type="text/css" href="'. $cssurl . '" />';
21505 - # $header .='<script src="" ></script>';
21506 - $header .= '<fb:dashboard/>';
21507 + $header = '<link rel="stylesheet" type="text/css" href="'. $cssurl . '" />';
21508 + # $header .='<script src="" ></script>';
21509 + $header .= '<fb:dashboard/>';
21510 hunk ./lib/facebookaction.php 99
21513 - .'<fb:tab-item title="Home" href="index.php" selected="' . ($selected == 'Home') .'" />'
21514 - .'<fb:tab-item title="Invite Friends" href="invite.php" selected="' . ($selected == 'Invite') . '" />'
21515 - .'<fb:tab-item title="Settings" href="settings.php" selected="' . ($selected == 'Settings') . '" />'
21517 - $header .= '<div id="main_body">';
21520 + .'<fb:tab-item title="Home" href="index.php" selected="' . ($selected == 'Home') .'" />'
21521 + .'<fb:tab-item title="Invite Friends" href="invite.php" selected="' . ($selected == 'Invite') . '" />'
21522 + .'<fb:tab-item title="Settings" href="settings.php" selected="' . ($selected == 'Settings') . '" />'
21524 + $header .= '<div id="main_body">';
21525 hunk ./lib/facebookaction.php 107
21528 hunk ./lib/facebookaction.php 109
21531 hunk ./lib/facebookaction.php 111
21532 - function show_footer() {
21533 - $footer = '</div>';
21536 + function show_footer() {
21537 + $footer = '</div>';
21540 hunk ./lib/facebookaction.php 116
21541 - function show_login_form() {
21542 + function show_login_form() {
21543 hunk ./lib/facebookaction.php 118
21545 - ' <h2>To add the Identi.ca application, you need to log into your Identi.ca account.</h2>'
21546 - .'<a href="http://identi.ca/">'
21547 - .' <img src="http://theme.identi.ca/identica/logo.png" alt="Identi.ca" id="logo"/>'
21549 - .'<h1 class="pagetitle">Login</h1>'
21550 - .'<div class="instructions">'
21551 - .' <p>Login with your username and password. Don\'t have a username yet?'
21552 - .' <a href="http://identi.ca/main/register">Register</a> a new account.'
21555 - .'<div id="content">'
21556 - .' <form method="post" id="login">'
21558 - .' <label for="nickname">Nickname</label>'
21559 - .' <input name="nickname" type="text" class="input_text" id="nickname"/>'
21562 - .' <label for="password">Password</label>'
21563 - .' <input name="password" type="password" class="password" id="password"/>'
21566 - .' <input type="submit" id="submit" name="submit" class="submit" value="Login"/>'
21570 - .' <a href="http://identi.ca/main/recoverpassword">Lost or forgotten password?</a>'
21574 + ' <h2>To add the Identi.ca application, you need to log into your Identi.ca account.</h2>'
21575 + .'<a href="http://identi.ca/">'
21576 + .' <img src="http://theme.identi.ca/identica/logo.png" alt="Identi.ca" id="logo"/>'
21578 + .'<h1 class="pagetitle">Login</h1>'
21579 + .'<div class="instructions">'
21580 + .' <p>Login with your username and password. Don\'t have a username yet?'
21581 + .' <a href="http://identi.ca/main/register">Register</a> a new account.'
21584 + .'<div id="content">'
21585 + .' <form method="post" id="login">'
21587 + .' <label for="nickname">Nickname</label>'
21588 + .' <input name="nickname" type="text" class="input_text" id="nickname"/>'
21591 + .' <label for="password">Password</label>'
21592 + .' <input name="password" type="password" class="password" id="password"/>'
21595 + .' <input type="submit" id="submit" name="submit" class="submit" value="Login"/>'
21599 + .' <a href="http://identi.ca/main/recoverpassword">Lost or forgotten password?</a>'
21602 hunk ./lib/facebookaction.php 148
21607 hunk ./lib/facebookaction.php 151
21608 - function render_notice($notice) {
21609 + function render_notice($notice) {
21610 hunk ./lib/facebookaction.php 153
21613 hunk ./lib/facebookaction.php 155
21614 - $profile = $notice->getProfile();
21615 - $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
21616 + $profile = $notice->getProfile();
21617 + $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
21618 hunk ./lib/facebookaction.php 158
21619 - $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
21620 + $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
21621 hunk ./lib/facebookaction.php 160
21622 - # XXX: we need to figure this out better. Is this right?
21623 - if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
21624 - $noticeurl = $notice->uri;
21626 + # XXX: we need to figure this out better. Is this right?
21627 + if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
21628 + $noticeurl = $notice->uri;
21630 hunk ./lib/facebookaction.php 165
21632 - '<li class="notice_single" id="' . $notice->id . '">'
21633 - .'<a href="' . $profile->profileurl . '">'
21636 + '<li class="notice_single" id="' . $notice->id . '">'
21637 + .'<a href="' . $profile->profileurl . '">'
21639 hunk ./lib/facebookaction.php 170
21641 - $html .= common_avatar_display_url($avatar);
21643 - $html .= common_default_avatar(AVATAR_STREAM_SIZE);
21646 + $html .= common_avatar_display_url($avatar);
21648 + $html .= common_default_avatar(AVATAR_STREAM_SIZE);
21650 hunk ./lib/facebookaction.php 176
21652 - '" class="avatar stream" width="'
21653 - . AVATAR_STREAM_SIZE . '" height="' . AVATAR_STREAM_SIZE .'"'
21656 + '" class="avatar stream" width="'
21657 + . AVATAR_STREAM_SIZE . '" height="' . AVATAR_STREAM_SIZE .'"'
21659 hunk ./lib/facebookaction.php 181
21660 - if ($profile->fullname) {
21661 - $html .= $profile->fullname;
21663 - $html .= $profile->nickname;
21665 + if ($profile->fullname) {
21666 + $html .= $profile->fullname;
21668 + $html .= $profile->nickname;
21670 hunk ./lib/facebookaction.php 187
21673 - .'<a href="' . $profile->profileurl . '" class="nickname">' . $profile->nickname . '</a>'
21674 - .'<p class="content">' . $notice->rendered . '</p>'
21675 - .'<p class="time">'
21676 - .'<a class="permalink" href="' . $noticeurl . '" title="' . common_exact_date($notice->created) . '">' . common_date_string($notice->created) . '</a>';
21679 + .'<a href="' . $profile->profileurl . '" class="nickname">' . $profile->nickname . '</a>'
21680 + .'<p class="content">' . $notice->rendered . '</p>'
21681 + .'<p class="time">'
21682 + .'<a class="permalink" href="' . $noticeurl . '" title="' . common_exact_date($notice->created) . '">' . common_date_string($notice->created) . '</a>';
21683 hunk ./lib/facebookaction.php 194
21684 - if ($notice->source) {
21685 - $html .= _(' from ');
21686 - $html .= $this->source_link($notice->source);
21688 + if ($notice->source) {
21689 + $html .= _(' from ');
21690 + $html .= $this->source_link($notice->source);
21692 hunk ./lib/facebookaction.php 199
21693 - if ($notice->reply_to) {
21694 - $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
21696 - ' (<a class="inreplyto" href="' . $replyurl . '">' . _('in reply to...') . ')';
21698 + if ($notice->reply_to) {
21699 + $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
21701 + ' (<a class="inreplyto" href="' . $replyurl . '">' . _('in reply to...') . ')';
21703 hunk ./lib/facebookaction.php 205
21704 - $html .= '</p></li>';
21705 + $html .= '</p></li>';
21706 hunk ./lib/facebookaction.php 207
21711 hunk ./lib/facebookaction.php 210
21712 - function source_link($source) {
21713 - $source_name = _($source);
21714 + function source_link($source) {
21715 + $source_name = _($source);
21716 hunk ./lib/facebookaction.php 213
21717 - $html = '<span class="noticesource">';
21718 + $html = '<span class="noticesource">';
21719 hunk ./lib/facebookaction.php 215
21720 - switch ($source) {
21726 - $html .= $source_name;
21729 - $ns = Notice_source::staticGet($source);
21731 - $html .= '<a href="' . $ns->url . '">' . $ns->name . '</a>';
21733 - $html .= $source_name;
21737 + switch ($source) {
21743 + $html .= $source_name;
21746 + $ns = Notice_source::staticGet($source);
21748 + $html .= '<a href="' . $ns->url . '">' . $ns->name . '</a>';
21750 + $html .= $source_name;
21754 hunk ./lib/facebookaction.php 233
21755 - $html .= '</span>';
21756 + $html .= '</span>';
21757 hunk ./lib/facebookaction.php 235
21762 hunk ./lib/facebookaction.php 238
21763 - function pagination($have_before, $have_after, $page, $fbaction, $args=NULL) {
21764 + function pagination($have_before, $have_after, $page, $fbaction, $args=NULL) {
21765 hunk ./lib/facebookaction.php 240
21768 hunk ./lib/facebookaction.php 242
21769 - if ($have_before || $have_after) {
21770 - $html = '<div id="pagination">';
21771 - $html .'<ul id="nav_pagination">';
21773 + if ($have_before || $have_after) {
21774 + $html = '<div id="pagination">';
21775 + $html .'<ul id="nav_pagination">';
21777 hunk ./lib/facebookaction.php 247
21778 - if ($have_before) {
21779 - $pargs = array('page' => $page-1);
21780 - $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
21781 - $html .= '<li class="before">';
21782 - $html .'<a href="' . $this->pagination_url($fbaction, $newargs) . '">' . _('« After') . '</a>';
21785 + if ($have_before) {
21786 + $pargs = array('page' => $page-1);
21787 + $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
21788 + $html .= '<li class="before">';
21789 + $html .'<a href="' . $this->pagination_url($fbaction, $newargs) . '">' . _('« After') . '</a>';
21792 hunk ./lib/facebookaction.php 255
21793 - if ($have_after) {
21794 - $pargs = array('page' => $page+1);
21795 - $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
21796 - $html .= '<li class="after">';
21797 - $html .'<a href="' . $this->pagination_url($fbaction, $newargs) . '">' . _('Before »') . '</a>';
21800 + if ($have_after) {
21801 + $pargs = array('page' => $page+1);
21802 + $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
21803 + $html .= '<li class="after">';
21804 + $html .'<a href="' . $this->pagination_url($fbaction, $newargs) . '">' . _('Before »') . '</a>';
21807 hunk ./lib/facebookaction.php 263
21808 - if ($have_before || $have_after) {
21813 + if ($have_before || $have_after) {
21818 hunk ./lib/facebookaction.php 269
21819 - function pagination_url($fbaction, $args=NULL) {
21821 + function pagination_url($fbaction, $args=NULL) {
21823 hunk ./lib/facebookaction.php 272
21826 hunk ./lib/facebookaction.php 274
21828 - foreach ($args as $key => $value) {
21829 - $extra .= "&${key}=${value}";
21833 + foreach ($args as $key => $value) {
21834 + $extra .= "&${key}=${value}";
21837 hunk ./lib/facebookaction.php 280
21838 - return "$fbaction?${extra}";
21840 + return "$fbaction?${extra}";
21842 hunk ./lib/oauthstore.php 26
21843 - # We keep a record of who's contacted us
21844 + # We keep a record of who's contacted us
21845 hunk ./lib/oauthstore.php 28
21846 - function lookup_consumer($consumer_key) {
21847 - $con = Consumer::staticGet('consumer_key', $consumer_key);
21849 - $con = new Consumer();
21850 - $con->consumer_key = $consumer_key;
21851 - $con->seed = common_good_rand(16);
21852 - $con->created = DB_DataObject_Cast::dateTime();
21853 - if (!$con->insert()) {
21857 - return new OAuthConsumer($con->consumer_key, '');
21859 + function lookup_consumer($consumer_key) {
21860 + $con = Consumer::staticGet('consumer_key', $consumer_key);
21862 + $con = new Consumer();
21863 + $con->consumer_key = $consumer_key;
21864 + $con->seed = common_good_rand(16);
21865 + $con->created = DB_DataObject_Cast::dateTime();
21866 + if (!$con->insert()) {
21870 + return new OAuthConsumer($con->consumer_key, '');
21872 hunk ./lib/oauthstore.php 42
21873 - function lookup_token($consumer, $token_type, $token_key) {
21874 - $t = new Token();
21875 - $t->consumer_key = $consumer->key;
21876 - $t->tok = $token_key;
21877 - $t->type = ($token_type == 'access') ? 1 : 0;
21878 - if ($t->find(true)) {
21879 - return new OAuthToken($t->tok, $t->secret);
21884 + function lookup_token($consumer, $token_type, $token_key) {
21885 + $t = new Token();
21886 + $t->consumer_key = $consumer->key;
21887 + $t->tok = $token_key;
21888 + $t->type = ($token_type == 'access') ? 1 : 0;
21889 + if ($t->find(true)) {
21890 + return new OAuthToken($t->tok, $t->secret);
21895 hunk ./lib/oauthstore.php 54
21896 - function lookup_nonce($consumer, $token, $nonce, $timestamp) {
21897 - $n = new Nonce();
21898 - $n->consumer_key = $consumer->key;
21899 - $n->tok = $token->key;
21900 - $n->nonce = $nonce;
21901 - if ($n->find(TRUE)) {
21904 - $n->timestamp = $timestamp;
21905 - $n->created = DB_DataObject_Cast::dateTime();
21910 + function lookup_nonce($consumer, $token, $nonce, $timestamp) {
21911 + $n = new Nonce();
21912 + $n->consumer_key = $consumer->key;
21913 + $n->tok = $token->key;
21914 + $n->nonce = $nonce;
21915 + if ($n->find(TRUE)) {
21918 + $n->timestamp = $timestamp;
21919 + $n->created = DB_DataObject_Cast::dateTime();
21924 hunk ./lib/oauthstore.php 69
21925 - function new_request_token($consumer) {
21926 - $t = new Token();
21927 - $t->consumer_key = $consumer->key;
21928 - $t->tok = common_good_rand(16);
21929 - $t->secret = common_good_rand(16);
21930 - $t->type = 0; # request
21931 - $t->state = 0; # unauthorized
21932 - $t->created = DB_DataObject_Cast::dateTime();
21933 - if (!$t->insert()) {
21936 - return new OAuthToken($t->tok, $t->secret);
21939 + function new_request_token($consumer) {
21940 + $t = new Token();
21941 + $t->consumer_key = $consumer->key;
21942 + $t->tok = common_good_rand(16);
21943 + $t->secret = common_good_rand(16);
21944 + $t->type = 0; # request
21945 + $t->state = 0; # unauthorized
21946 + $t->created = DB_DataObject_Cast::dateTime();
21947 + if (!$t->insert()) {
21950 + return new OAuthToken($t->tok, $t->secret);
21953 hunk ./lib/oauthstore.php 84
21954 - # defined in OAuthDataStore, but not implemented anywhere
21955 + # defined in OAuthDataStore, but not implemented anywhere
21956 hunk ./lib/oauthstore.php 86
21957 - function fetch_request_token($consumer) {
21958 - return $this->new_request_token($consumer);
21960 + function fetch_request_token($consumer) {
21961 + return $this->new_request_token($consumer);
21963 hunk ./lib/oauthstore.php 90
21964 - function new_access_token($token, $consumer) {
21965 - common_debug('new_access_token("'.$token->key.'","'.$consumer->key.'")', __FILE__);
21966 - $rt = new Token();
21967 - $rt->consumer_key = $consumer->key;
21968 - $rt->tok = $token->key;
21969 - $rt->type = 0; # request
21970 - if ($rt->find(TRUE) && $rt->state == 1) { # authorized
21971 - common_debug('request token found.', __FILE__);
21972 - $at = new Token();
21973 - $at->consumer_key = $consumer->key;
21974 - $at->tok = common_good_rand(16);
21975 - $at->secret = common_good_rand(16);
21976 - $at->type = 1; # access
21977 - $at->created = DB_DataObject_Cast::dateTime();
21978 - if (!$at->insert()) {
21979 - $e = $at->_lastError;
21980 - common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__);
21983 - common_debug('access token "'.$at->tok.'" inserted', __FILE__);
21984 - # burn the old one
21985 - $orig_rt = clone($rt);
21986 - $rt->state = 2; # used
21987 - if (!$rt->update($orig_rt)) {
21990 - common_debug('request token "'.$rt->tok.'" updated', __FILE__);
21991 - # Update subscription
21992 - # XXX: mixing levels here
21993 - $sub = Subscription::staticGet('token', $rt->tok);
21997 - common_debug('subscription for request token found', __FILE__);
21998 - $orig_sub = clone($sub);
21999 - $sub->token = $at->tok;
22000 - $sub->secret = $at->secret;
22001 - if (!$sub->update($orig_sub)) {
22004 - common_debug('subscription updated to use access token', __FILE__);
22005 - return new OAuthToken($at->tok, $at->secret);
22012 + function new_access_token($token, $consumer) {
22013 + common_debug('new_access_token("'.$token->key.'","'.$consumer->key.'")', __FILE__);
22014 + $rt = new Token();
22015 + $rt->consumer_key = $consumer->key;
22016 + $rt->tok = $token->key;
22017 + $rt->type = 0; # request
22018 + if ($rt->find(TRUE) && $rt->state == 1) { # authorized
22019 + common_debug('request token found.', __FILE__);
22020 + $at = new Token();
22021 + $at->consumer_key = $consumer->key;
22022 + $at->tok = common_good_rand(16);
22023 + $at->secret = common_good_rand(16);
22024 + $at->type = 1; # access
22025 + $at->created = DB_DataObject_Cast::dateTime();
22026 + if (!$at->insert()) {
22027 + $e = $at->_lastError;
22028 + common_debug('access token "'.$at->tok.'" not inserted: "'.$e->message.'"', __FILE__);
22031 + common_debug('access token "'.$at->tok.'" inserted', __FILE__);
22032 + # burn the old one
22033 + $orig_rt = clone($rt);
22034 + $rt->state = 2; # used
22035 + if (!$rt->update($orig_rt)) {
22038 + common_debug('request token "'.$rt->tok.'" updated', __FILE__);
22039 + # Update subscription
22040 + # XXX: mixing levels here
22041 + $sub = Subscription::staticGet('token', $rt->tok);
22045 + common_debug('subscription for request token found', __FILE__);
22046 + $orig_sub = clone($sub);
22047 + $sub->token = $at->tok;
22048 + $sub->secret = $at->secret;
22049 + if (!$sub->update($orig_sub)) {
22052 + common_debug('subscription updated to use access token', __FILE__);
22053 + return new OAuthToken($at->tok, $at->secret);
22060 hunk ./lib/oauthstore.php 139
22061 - # defined in OAuthDataStore, but not implemented anywhere
22062 + # defined in OAuthDataStore, but not implemented anywhere
22063 hunk ./lib/oauthstore.php 141
22064 - function fetch_access_token($consumer) {
22065 - return $this->new_access_token($consumer);
22067 + function fetch_access_token($consumer) {
22068 + return $this->new_access_token($consumer);
22070 hunk ./lib/omb.php 47
22071 - static $con = NULL;
22073 - $con = new OAuthConsumer(common_root_url(), '');
22076 + static $con = NULL;
22078 + $con = new OAuthConsumer(common_root_url(), '');
22081 hunk ./lib/omb.php 55
22082 - static $server = null;
22084 - $server = new OAuthServer(omb_oauth_datastore());
22085 - $server->add_signature_method(omb_hmac_sha1());
22088 + static $server = null;
22090 + $server = new OAuthServer(omb_oauth_datastore());
22091 + $server->add_signature_method(omb_hmac_sha1());
22094 hunk ./lib/omb.php 64
22095 - static $store = NULL;
22097 - $store = new LaconicaOAuthDataStore();
22100 + static $store = NULL;
22102 + $store = new LaconicaOAuthDataStore();
22105 hunk ./lib/omb.php 72
22106 - static $hmac_method = NULL;
22107 - if (!$hmac_method) {
22108 - $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
22110 - return $hmac_method;
22111 + static $hmac_method = NULL;
22112 + if (!$hmac_method) {
22113 + $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
22115 + return $hmac_method;
22116 hunk ./lib/omb.php 80
22117 - return $xrd->services(array(omb_service_filter($type)));
22118 + return $xrd->services(array(omb_service_filter($type)));
22119 hunk ./lib/omb.php 84
22120 - return create_function('$s',
22121 - 'return omb_match_service($s, \''.$type.'\');');
22122 + return create_function('$s',
22123 + 'return omb_match_service($s, \''.$type.'\');');
22124 hunk ./lib/omb.php 89
22125 - return in_array($type, $service->getTypes());
22126 + return in_array($type, $service->getTypes());
22127 hunk ./lib/omb.php 93
22131 - $uris = $service->getURIs();
22139 + $uris = $service->getURIs();
22144 hunk ./lib/omb.php 104
22148 - $els = $service->getElements('xrd:LocalID');
22153 - return $service->parser->content($el);
22157 + $els = $service->getElements('xrd:LocalID');
22162 + return $service->parser->content($el);
22163 hunk ./lib/omb.php 117
22164 - # First, get remote users subscribed to this profile
22165 - $rp = new Remote_profile();
22166 + # First, get remote users subscribed to this profile
22167 + $rp = new Remote_profile();
22168 hunk ./lib/omb.php 120
22169 - $rp->query('SELECT postnoticeurl, token, secret ' .
22170 - 'FROM subscription JOIN remote_profile ' .
22171 - 'ON subscription.subscriber = remote_profile.id ' .
22172 - 'WHERE subscription.subscribed = ' . $notice->profile_id . ' ');
22173 + $rp->query('SELECT postnoticeurl, token, secret ' .
22174 + 'FROM subscription JOIN remote_profile ' .
22175 + 'ON subscription.subscriber = remote_profile.id ' .
22176 + 'WHERE subscription.subscribed = ' . $notice->profile_id . ' ');
22177 hunk ./lib/omb.php 125
22178 - $posted = array();
22179 + $posted = array();
22180 hunk ./lib/omb.php 127
22181 - while ($rp->fetch()) {
22182 - if (!$posted[$rp->postnoticeurl]) {
22183 - common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl);
22184 - if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) {
22185 - common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl);
22186 - $posted[$rp->postnoticeurl] = TRUE;
22188 - common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl);
22192 + while ($rp->fetch()) {
22193 + if (!$posted[$rp->postnoticeurl]) {
22194 + common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl);
22195 + if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) {
22196 + common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl);
22197 + $posted[$rp->postnoticeurl] = TRUE;
22199 + common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl);
22203 hunk ./lib/omb.php 139
22208 hunk ./lib/omb.php 142
22211 hunk ./lib/omb.php 146
22212 - return omb_post_notice_keys($notice, $remote_profile->postnoticeurl, $subscription->token, $subscription->secret);
22213 + return omb_post_notice_keys($notice, $remote_profile->postnoticeurl, $subscription->token, $subscription->secret);
22214 hunk ./lib/omb.php 151
22215 - common_debug('Posting notice ' . $notice->id . ' to ' . $postnoticeurl, __FILE__);
22216 + common_debug('Posting notice ' . $notice->id . ' to ' . $postnoticeurl, __FILE__);
22217 hunk ./lib/omb.php 153
22218 - $user = User::staticGet('id', $notice->profile_id);
22219 + $user = User::staticGet('id', $notice->profile_id);
22220 hunk ./lib/omb.php 155
22222 - common_debug('Failed to get user for notice ' . $notice->id . ', profile = ' . $notice->profile_id, __FILE__);
22226 + common_debug('Failed to get user for notice ' . $notice->id . ', profile = ' . $notice->profile_id, __FILE__);
22229 hunk ./lib/omb.php 160
22230 - $con = omb_oauth_consumer();
22231 + $con = omb_oauth_consumer();
22232 hunk ./lib/omb.php 162
22233 - $token = new OAuthToken($tk, $secret);
22234 + $token = new OAuthToken($tk, $secret);
22235 hunk ./lib/omb.php 164
22236 - $url = $postnoticeurl;
22237 - $parsed = parse_url($url);
22238 - $params = array();
22239 - parse_str($parsed['query'], $params);
22240 + $url = $postnoticeurl;
22241 + $parsed = parse_url($url);
22242 + $params = array();
22243 + parse_str($parsed['query'], $params);
22244 hunk ./lib/omb.php 169
22245 - $req = OAuthRequest::from_consumer_and_token($con, $token,
22246 - 'POST', $url, $params);
22247 + $req = OAuthRequest::from_consumer_and_token($con, $token,
22248 + 'POST', $url, $params);
22249 hunk ./lib/omb.php 172
22250 - $req->set_parameter('omb_version', OMB_VERSION_01);
22251 - $req->set_parameter('omb_listenee', $user->uri);
22252 - $req->set_parameter('omb_notice', $notice->uri);
22253 - $req->set_parameter('omb_notice_content', $notice->content);
22254 - $req->set_parameter('omb_notice_url', common_local_url('shownotice',
22255 - array('notice' =>
22257 - $req->set_parameter('omb_notice_license', common_config('license', 'url'));
22258 + $req->set_parameter('omb_version', OMB_VERSION_01);
22259 + $req->set_parameter('omb_listenee', $user->uri);
22260 + $req->set_parameter('omb_notice', $notice->uri);
22261 + $req->set_parameter('omb_notice_content', $notice->content);
22262 + $req->set_parameter('omb_notice_url', common_local_url('shownotice',
22263 + array('notice' =>
22265 + $req->set_parameter('omb_notice_license', common_config('license', 'url'));
22266 hunk ./lib/omb.php 181
22271 hunk ./lib/omb.php 184
22272 - $req->sign_request(omb_hmac_sha1(), $con, $token);
22273 + $req->sign_request(omb_hmac_sha1(), $con, $token);
22274 hunk ./lib/omb.php 186
22275 - # We re-use this tool's fetcher, since it's pretty good
22276 + # We re-use this tool's fetcher, since it's pretty good
22277 hunk ./lib/omb.php 188
22278 - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
22279 + $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
22280 hunk ./lib/omb.php 190
22282 - common_log(LOG_WARNING, 'Failed to initialize Yadis fetcher.', __FILE__);
22286 + common_log(LOG_WARNING, 'Failed to initialize Yadis fetcher.', __FILE__);
22289 hunk ./lib/omb.php 195
22290 - $result = $fetcher->post($req->get_normalized_http_url(),
22291 - $req->to_postdata(),
22292 + $result = $fetcher->post($req->get_normalized_http_url(),
22293 + $req->to_postdata(),
22294 hunk ./lib/omb.php 199
22295 - common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
22296 + common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
22297 hunk ./lib/omb.php 201
22298 - if ($result->status == 403) { # not authorized, don't send again
22299 - common_debug('403 result, deleting subscription', __FILE__);
22300 - # FIXME: figure out how to delete this
22301 - # $subscription->delete();
22303 - } else if ($result->status != 200) {
22304 - common_debug('Error status '.$result->status, __FILE__);
22306 - } else { # success!
22307 - parse_str($result->body, $return);
22308 - if ($return['omb_version'] == OMB_VERSION_01) {
22314 + if ($result->status == 403) { # not authorized, don't send again
22315 + common_debug('403 result, deleting subscription', __FILE__);
22316 + # FIXME: figure out how to delete this
22317 + # $subscription->delete();
22319 + } else if ($result->status != 200) {
22320 + common_debug('Error status '.$result->status, __FILE__);
22322 + } else { # success!
22323 + parse_str($result->body, $return);
22324 + if ($return['omb_version'] == OMB_VERSION_01) {
22330 hunk ./lib/omb.php 220
22331 - # First, get remote users subscribed to this profile
22332 - # XXX: use a join here rather than looping through results
22333 - $sub = new Subscription();
22334 - $sub->subscribed = $profile->id;
22335 - if ($sub->find()) {
22336 - $updated = array();
22337 - while ($sub->fetch()) {
22338 - $rp = Remote_profile::staticGet('id', $sub->subscriber);
22340 - if (!$updated[$rp->updateprofileurl]) {
22341 - if (omb_update_profile($profile, $rp, $sub)) {
22342 - $updated[$rp->updateprofileurl] = TRUE;
22348 + # First, get remote users subscribed to this profile
22349 + # XXX: use a join here rather than looping through results
22350 + $sub = new Subscription();
22351 + $sub->subscribed = $profile->id;
22352 + if ($sub->find()) {
22353 + $updated = array();
22354 + while ($sub->fetch()) {
22355 + $rp = Remote_profile::staticGet('id', $sub->subscriber);
22357 + if (!$updated[$rp->updateprofileurl]) {
22358 + if (omb_update_profile($profile, $rp, $sub)) {
22359 + $updated[$rp->updateprofileurl] = TRUE;
22365 hunk ./lib/omb.php 240
22366 - global $config; # for license URL
22367 - $user = User::staticGet($profile->id);
22368 - $con = omb_oauth_consumer();
22369 - $token = new OAuthToken($subscription->token, $subscription->secret);
22370 - $url = $remote_profile->updateprofileurl;
22371 - $parsed = parse_url($url);
22372 - $params = array();
22373 - parse_str($parsed['query'], $params);
22374 - $req = OAuthRequest::from_consumer_and_token($con, $token,
22375 - "POST", $url, $params);
22376 - $req->set_parameter('omb_version', OMB_VERSION_01);
22377 - $req->set_parameter('omb_listenee', $user->uri);
22378 - $req->set_parameter('omb_listenee_profile', common_profile_url($profile->nickname));
22379 - $req->set_parameter('omb_listenee_nickname', $profile->nickname);
22380 + global $config; # for license URL
22381 + $user = User::staticGet($profile->id);
22382 + $con = omb_oauth_consumer();
22383 + $token = new OAuthToken($subscription->token, $subscription->secret);
22384 + $url = $remote_profile->updateprofileurl;
22385 + $parsed = parse_url($url);
22386 + $params = array();
22387 + parse_str($parsed['query'], $params);
22388 + $req = OAuthRequest::from_consumer_and_token($con, $token,
22389 + "POST", $url, $params);
22390 + $req->set_parameter('omb_version', OMB_VERSION_01);
22391 + $req->set_parameter('omb_listenee', $user->uri);
22392 + $req->set_parameter('omb_listenee_profile', common_profile_url($profile->nickname));
22393 + $req->set_parameter('omb_listenee_nickname', $profile->nickname);
22394 hunk ./lib/omb.php 255
22395 - # We use blanks to force emptying any existing values in these optional fields
22396 + # We use blanks to force emptying any existing values in these optional fields
22397 hunk ./lib/omb.php 257
22398 - $req->set_parameter('omb_listenee_fullname',
22399 - ($profile->fullname) ? $profile->fullname : '');
22400 - $req->set_parameter('omb_listenee_homepage',
22401 - ($profile->homepage) ? $profile->homepage : '');
22402 - $req->set_parameter('omb_listenee_bio',
22403 - ($profile->bio) ? $profile->bio : '');
22404 - $req->set_parameter('omb_listenee_location',
22405 - ($profile->location) ? $profile->location : '');
22406 + $req->set_parameter('omb_listenee_fullname',
22407 + ($profile->fullname) ? $profile->fullname : '');
22408 + $req->set_parameter('omb_listenee_homepage',
22409 + ($profile->homepage) ? $profile->homepage : '');
22410 + $req->set_parameter('omb_listenee_bio',
22411 + ($profile->bio) ? $profile->bio : '');
22412 + $req->set_parameter('omb_listenee_location',
22413 + ($profile->location) ? $profile->location : '');
22414 hunk ./lib/omb.php 266
22415 - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
22416 - $req->set_parameter('omb_listenee_avatar',
22417 - ($avatar) ? $avatar->url : '');
22418 + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
22419 + $req->set_parameter('omb_listenee_avatar',
22420 + ($avatar) ? $avatar->url : '');
22421 hunk ./lib/omb.php 270
22422 - $req->sign_request(omb_hmac_sha1(), $con, $token);
22423 + $req->sign_request(omb_hmac_sha1(), $con, $token);
22424 hunk ./lib/omb.php 272
22425 - # We re-use this tool's fetcher, since it's pretty good
22426 + # We re-use this tool's fetcher, since it's pretty good
22427 hunk ./lib/omb.php 274
22428 - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
22429 + $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
22430 hunk ./lib/omb.php 276
22431 - common_debug('request URL = '.$req->get_normalized_http_url(), __FILE__);
22432 - common_debug('postdata = '.$req->to_postdata(), __FILE__);
22433 - $result = $fetcher->post($req->get_normalized_http_url(),
22434 - $req->to_postdata(),
22435 + common_debug('request URL = '.$req->get_normalized_http_url(), __FILE__);
22436 + common_debug('postdata = '.$req->to_postdata(), __FILE__);
22437 + $result = $fetcher->post($req->get_normalized_http_url(),
22438 + $req->to_postdata(),
22439 hunk ./lib/omb.php 282
22440 - common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
22441 + common_debug('Got HTTP result "'.print_r($result,TRUE).'"', __FILE__);
22442 hunk ./lib/omb.php 284
22443 - if ($result->status == 403) { # not authorized, don't send again
22444 - common_debug('403 result, deleting subscription', __FILE__);
22445 - $subscription->delete();
22447 - } else if ($result->status != 200) {
22448 - common_debug('Error status '.$result->status, __FILE__);
22450 - } else { # success!
22451 - parse_str($result->body, $return);
22452 - if ($return['omb_version'] == OMB_VERSION_01) {
22458 + if ($result->status == 403) { # not authorized, don't send again
22459 + common_debug('403 result, deleting subscription', __FILE__);
22460 + $subscription->delete();
22462 + } else if ($result->status != 200) {
22463 + common_debug('Error status '.$result->status, __FILE__);
22465 + } else { # success!
22466 + parse_str($result->body, $return);
22467 + if ($return['omb_version'] == OMB_VERSION_01) {
22473 hunk ./lib/openid.php 36
22475 - # Can't be called statically
22476 - $user = new User();
22477 - $conn = $user->getDatabaseConnection();
22478 - $store = new Auth_OpenID_MySQLStore($conn);
22482 + # Can't be called statically
22483 + $user = new User();
22484 + $conn = $user->getDatabaseConnection();
22485 + $store = new Auth_OpenID_MySQLStore($conn);
22488 hunk ./lib/openid.php 46
22489 - $store = oid_store();
22490 - $consumer = new Auth_OpenID_Consumer($store);
22491 - return $consumer;
22492 + $store = oid_store();
22493 + $consumer = new Auth_OpenID_Consumer($store);
22494 + return $consumer;
22495 hunk ./lib/openid.php 52
22496 - oid_set_last('');
22497 + oid_set_last('');
22498 hunk ./lib/openid.php 56
22499 - common_set_cookie(OPENID_COOKIE_KEY,
22501 - time() + OPENID_COOKIE_EXPIRY);
22502 + common_set_cookie(OPENID_COOKIE_KEY,
22504 + time() + OPENID_COOKIE_EXPIRY);
22505 hunk ./lib/openid.php 62
22506 - $openid_url = $_COOKIE[OPENID_COOKIE_KEY];
22507 - if ($openid_url && strlen($openid_url) > 0) {
22508 - return $openid_url;
22512 + $openid_url = $_COOKIE[OPENID_COOKIE_KEY];
22513 + if ($openid_url && strlen($openid_url) > 0) {
22514 + return $openid_url;
22518 hunk ./lib/openid.php 72
22519 - $oid = new User_openid();
22520 - $oid->user_id = $id;
22521 - $oid->canonical = $canonical;
22522 - $oid->display = $display;
22523 - $oid->created = DB_DataObject_Cast::dateTime();
22524 + $oid = new User_openid();
22525 + $oid->user_id = $id;
22526 + $oid->canonical = $canonical;
22527 + $oid->display = $display;
22528 + $oid->created = DB_DataObject_Cast::dateTime();
22529 hunk ./lib/openid.php 78
22530 - if (!$oid->insert()) {
22531 - $err = PEAR::getStaticProperty('DB_DataObject','lastError');
22532 - common_debug('DB error ' . $err->code . ': ' . $err->message, __FILE__);
22535 + if (!$oid->insert()) {
22536 + $err = PEAR::getStaticProperty('DB_DataObject','lastError');
22537 + common_debug('DB error ' . $err->code . ': ' . $err->message, __FILE__);
22540 hunk ./lib/openid.php 84
22543 hunk ./lib/openid.php 88
22545 - $oid = User_openid::staticGet('canonical', $openid_url);
22547 - $user = User::staticGet('id', $oid->user_id);
22551 + $oid = User_openid::staticGet('canonical', $openid_url);
22553 + $user = User::staticGet('id', $oid->user_id);
22556 hunk ./lib/openid.php 97
22558 - $action = $_REQUEST['action'];
22559 - $args = common_copy_args($_GET);
22560 - unset($args['action']);
22561 - $backto = common_local_url($action, $args);
22563 - common_debug('going back to "' . $backto . '"', __FILE__);
22565 + $action = $_REQUEST['action'];
22566 + $args = common_copy_args($_GET);
22567 + unset($args['action']);
22568 + $backto = common_local_url($action, $args);
22570 + common_debug('going back to "' . $backto . '"', __FILE__);
22571 hunk ./lib/openid.php 105
22572 - common_ensure_session();
22573 + common_ensure_session();
22574 hunk ./lib/openid.php 107
22575 - $_SESSION['openid_immediate_backto'] = $backto;
22576 - common_debug('passed-in variable is "' . $backto . '"', __FILE__);
22577 - common_debug('session variable is "' . $_SESSION['openid_immediate_backto'] . '"', __FILE__);
22578 + $_SESSION['openid_immediate_backto'] = $backto;
22579 + common_debug('passed-in variable is "' . $backto . '"', __FILE__);
22580 + common_debug('session variable is "' . $_SESSION['openid_immediate_backto'] . '"', __FILE__);
22581 hunk ./lib/openid.php 111
22582 - oid_authenticate($openid_url,
22583 - 'finishimmediate',
22585 + oid_authenticate($openid_url,
22586 + 'finishimmediate',
22588 hunk ./lib/openid.php 118
22589 - $consumer = oid_consumer();
22590 + $consumer = oid_consumer();
22591 hunk ./lib/openid.php 120
22592 - if (!$consumer) {
22593 - common_server_error(_('Cannot instantiate OpenID consumer object.'));
22596 + if (!$consumer) {
22597 + common_server_error(_('Cannot instantiate OpenID consumer object.'));
22600 hunk ./lib/openid.php 125
22601 - common_ensure_session();
22602 + common_ensure_session();
22603 hunk ./lib/openid.php 127
22604 - $auth_request = $consumer->begin($openid_url);
22605 + $auth_request = $consumer->begin($openid_url);
22606 hunk ./lib/openid.php 129
22607 - // Handle failure status return values.
22608 - if (!$auth_request) {
22609 - return _('Not a valid OpenID.');
22610 - } else if (Auth_OpenID::isFailure($auth_request)) {
22611 - return sprintf(_('OpenID failure: %s'), $auth_request->message);
22613 + // Handle failure status return values.
22614 + if (!$auth_request) {
22615 + return _('Not a valid OpenID.');
22616 + } else if (Auth_OpenID::isFailure($auth_request)) {
22617 + return sprintf(_('OpenID failure: %s'), $auth_request->message);
22619 hunk ./lib/openid.php 136
22620 - $sreg_request = Auth_OpenID_SRegRequest::build(// Required
22623 - array('nickname',
22630 + $sreg_request = Auth_OpenID_SRegRequest::build(// Required
22633 + array('nickname',
22640 hunk ./lib/openid.php 147
22641 - if ($sreg_request) {
22642 - $auth_request->addExtension($sreg_request);
22644 + if ($sreg_request) {
22645 + $auth_request->addExtension($sreg_request);
22647 hunk ./lib/openid.php 151
22648 - $trust_root = common_local_url('public');
22649 - $process_url = common_local_url($returnto);
22650 + $trust_root = common_local_url('public');
22651 + $process_url = common_local_url($returnto);
22652 hunk ./lib/openid.php 154
22653 - if ($auth_request->shouldSendRedirect()) {
22654 - $redirect_url = $auth_request->redirectURL($trust_root,
22657 - if (!$redirect_url) {
22658 - } else if (Auth_OpenID::isFailure($redirect_url)) {
22659 - return sprintf(_('Could not redirect to server: %s'), $redirect_url->message);
22661 - common_redirect($redirect_url);
22664 - // Generate form markup and render it.
22665 - $form_id = 'openid_message';
22666 - $form_html = $auth_request->formMarkup($trust_root, $process_url,
22667 - $immediate, array('id' => $form_id));
22668 + if ($auth_request->shouldSendRedirect()) {
22669 + $redirect_url = $auth_request->redirectURL($trust_root,
22672 + if (!$redirect_url) {
22673 + } else if (Auth_OpenID::isFailure($redirect_url)) {
22674 + return sprintf(_('Could not redirect to server: %s'), $redirect_url->message);
22676 + common_redirect($redirect_url);
22679 + // Generate form markup and render it.
22680 + $form_id = 'openid_message';
22681 + $form_html = $auth_request->formMarkup($trust_root, $process_url,
22682 + $immediate, array('id' => $form_id));
22683 hunk ./lib/openid.php 170
22684 - # XXX: This is cheap, but things choke if we don't escape ampersands
22685 - # in the HTML attributes
22686 + # XXX: This is cheap, but things choke if we don't escape ampersands
22687 + # in the HTML attributes
22688 hunk ./lib/openid.php 173
22689 - $form_html = preg_replace('/&/', '&', $form_html);
22690 + $form_html = preg_replace('/&/', '&', $form_html);
22691 hunk ./lib/openid.php 175
22692 - // Display an error if the form markup couldn't be generated;
22693 - // otherwise, render the HTML.
22694 - if (Auth_OpenID::isFailure($form_html)) {
22695 - $this->show_form(sprintf(_('Could not create OpenID form: %s'), $form_html->message));
22697 - common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
22698 - common_raw($form_html);
22699 - common_element('script', NULL,
22700 - '$(document).ready(function() { ' .
22701 - ' $("#'. $form_id .'").submit(); '.
22703 - common_show_footer();
22706 + // Display an error if the form markup couldn't be generated;
22707 + // otherwise, render the HTML.
22708 + if (Auth_OpenID::isFailure($form_html)) {
22709 + $this->show_form(sprintf(_('Could not create OpenID form: %s'), $form_html->message));
22711 + common_show_header(_('OpenID Auto-Submit'), NULL, NULL, '_oid_print_instructions');
22712 + common_raw($form_html);
22713 + common_element('script', NULL,
22714 + '$(document).ready(function() { ' .
22715 + ' $("#'. $form_id .'").submit(); '.
22717 + common_show_footer();
22720 hunk ./lib/openid.php 194
22721 - common_element('div', 'instructions',
22722 - _('This form should automatically submit itself. '.
22723 - 'If not, click the submit button to go to your '.
22724 - 'OpenID provider.'));
22725 + common_element('div', 'instructions',
22726 + _('This form should automatically submit itself. '.
22727 + 'If not, click the submit button to go to your '.
22728 + 'OpenID provider.'));
22729 hunk ./lib/openid.php 204
22730 - $profile = $user->getProfile();
22731 + $profile = $user->getProfile();
22732 hunk ./lib/openid.php 206
22733 - $orig_profile = clone($profile);
22734 + $orig_profile = clone($profile);
22735 hunk ./lib/openid.php 208
22736 - if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
22737 - $profile->fullname = $sreg['fullname'];
22739 + if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
22740 + $profile->fullname = $sreg['fullname'];
22742 hunk ./lib/openid.php 212
22743 - if ($sreg['country']) {
22744 - if ($sreg['postcode']) {
22745 - # XXX: use postcode to get city and region
22746 - # XXX: also, store postcode somewhere -- it's valuable!
22747 - $profile->location = $sreg['postcode'] . ', ' . $sreg['country'];
22749 - $profile->location = $sreg['country'];
22752 + if ($sreg['country']) {
22753 + if ($sreg['postcode']) {
22754 + # XXX: use postcode to get city and region
22755 + # XXX: also, store postcode somewhere -- it's valuable!
22756 + $profile->location = $sreg['postcode'] . ', ' . $sreg['country'];
22758 + $profile->location = $sreg['country'];
22761 hunk ./lib/openid.php 222
22762 - # XXX save language if it's passed
22763 - # XXX save timezone if it's passed
22764 + # XXX save language if it's passed
22765 + # XXX save timezone if it's passed
22766 hunk ./lib/openid.php 225
22767 - if (!$profile->update($orig_profile)) {
22768 - common_server_error(_('Error saving the profile.'));
22771 + if (!$profile->update($orig_profile)) {
22772 + common_server_error(_('Error saving the profile.'));
22775 hunk ./lib/openid.php 230
22776 - $orig_user = clone($user);
22777 + $orig_user = clone($user);
22778 hunk ./lib/openid.php 232
22779 - if ($sreg['email'] && Validate::email($sreg['email'], true)) {
22780 - $user->email = $sreg['email'];
22782 + if ($sreg['email'] && Validate::email($sreg['email'], true)) {
22783 + $user->email = $sreg['email'];
22785 hunk ./lib/openid.php 236
22786 - if (!$user->update($orig_user)) {
22787 - common_server_error(_('Error saving the user.'));
22790 + if (!$user->update($orig_user)) {
22791 + common_server_error(_('Error saving the user.'));
22794 hunk ./lib/openid.php 241
22797 hunk ./lib/personal.php 23
22799 - function is_readonly() {
22803 - function handle($args) {
22804 - parent::handle($args);
22805 - common_set_returnto($this->self_url());
22808 + function is_readonly() {
22812 + function handle($args) {
22813 + parent::handle($args);
22814 + common_set_returnto($this->self_url());
22816 hunk ./lib/personal.php 33
22817 - function views_menu() {
22818 + function views_menu() {
22819 hunk ./lib/personal.php 35
22821 - $action = $this->trimmed('action');
22822 - $nickname = $this->trimmed('nickname');
22824 + $action = $this->trimmed('action');
22825 + $nickname = $this->trimmed('nickname');
22826 hunk ./lib/personal.php 39
22828 - $user = User::staticGet('nickname', $nickname);
22829 - $user_profile = $user->getProfile();
22831 - $user_profile = false;
22834 + $user = User::staticGet('nickname', $nickname);
22835 + $user_profile = $user->getProfile();
22837 + $user_profile = false;
22839 hunk ./lib/personal.php 46
22840 - common_element_start('ul', array('id' => 'nav_views'));
22841 + common_element_start('ul', array('id' => 'nav_views'));
22842 hunk ./lib/personal.php 48
22843 - common_menu_item(common_local_url('all', array('nickname' =>
22846 - sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
22847 - $action == 'all');
22848 - common_menu_item(common_local_url('replies', array('nickname' =>
22851 - sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
22852 - $action == 'replies');
22853 - common_menu_item(common_local_url('showstream', array('nickname' =>
22856 - ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
22857 - $action == 'showstream');
22858 - common_menu_item(common_local_url('showfavorites', array('nickname' =>
22861 - sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
22862 - $action == 'showfavorites');
22864 - $cur = common_current_user();
22866 - if ($cur && $cur->id == $user->id) {
22868 - common_menu_item(common_local_url('inbox', array('nickname' =>
22871 - _('Your incoming messages'),
22872 - $action == 'inbox');
22873 - common_menu_item(common_local_url('outbox', array('nickname' =>
22876 - _('Your sent messages'),
22877 - $action == 'outbox');
22880 - common_element_end('ul');
22882 + common_menu_item(common_local_url('all', array('nickname' =>
22885 + sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
22886 + $action == 'all');
22887 + common_menu_item(common_local_url('replies', array('nickname' =>
22890 + sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
22891 + $action == 'replies');
22892 + common_menu_item(common_local_url('showstream', array('nickname' =>
22895 + ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
22896 + $action == 'showstream');
22897 + common_menu_item(common_local_url('showfavorites', array('nickname' =>
22900 + sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
22901 + $action == 'showfavorites');
22903 + $cur = common_current_user();
22905 + if ($cur && $cur->id == $user->id) {
22907 + common_menu_item(common_local_url('inbox', array('nickname' =>
22910 + _('Your incoming messages'),
22911 + $action == 'inbox');
22912 + common_menu_item(common_local_url('outbox', array('nickname' =>
22915 + _('Your sent messages'),
22916 + $action == 'outbox');
22919 + common_element_end('ul');
22921 hunk ./lib/personal.php 88
22922 - function show_feeds_list($feeds) {
22923 - common_element_start('div', array('class' => 'feeds'));
22924 - common_element('p', null, 'Feeds:');
22925 - common_element_start('ul', array('class' => 'xoxo'));
22926 + function show_feeds_list($feeds) {
22927 + common_element_start('div', array('class' => 'feeds'));
22928 + common_element('p', null, 'Feeds:');
22929 + common_element_start('ul', array('class' => 'xoxo'));
22930 hunk ./lib/personal.php 93
22931 - foreach ($feeds as $key => $value) {
22932 - $this->common_feed_item($feeds[$key]);
22934 - common_element_end('ul');
22935 - common_element_end('div');
22937 + foreach ($feeds as $key => $value) {
22938 + $this->common_feed_item($feeds[$key]);
22940 + common_element_end('ul');
22941 + common_element_end('div');
22943 hunk ./lib/personal.php 100
22944 - function common_feed_item($feed) {
22945 - $nickname = $this->trimmed('nickname');
22946 + function common_feed_item($feed) {
22947 + $nickname = $this->trimmed('nickname');
22948 hunk ./lib/personal.php 103
22949 - switch($feed['item']) {
22950 - case 'notices': default:
22951 - $feed_classname = $feed['type'];
22952 - $feed_mimetype = "application/".$feed['type']."+xml";
22953 - $feed_title = "$nickname's ".$feed['version']." notice feed";
22954 - $feed['textContent'] = "RSS";
22956 + switch($feed['item']) {
22957 + case 'notices': default:
22958 + $feed_classname = $feed['type'];
22959 + $feed_mimetype = "application/".$feed['type']."+xml";
22960 + $feed_title = "$nickname's ".$feed['version']." notice feed";
22961 + $feed['textContent'] = "RSS";
22963 hunk ./lib/personal.php 111
22965 - $feed_classname = $feed['type'];
22966 - $feed_mimetype = "application/".$feed['type']."+xml";
22967 - $feed_title = $feed['version']." feed for $nickname and friends";
22968 - $feed['textContent'] = "RSS";
22971 + $feed_classname = $feed['type'];
22972 + $feed_mimetype = "application/".$feed['type']."+xml";
22973 + $feed_title = $feed['version']." feed for $nickname and friends";
22974 + $feed['textContent'] = "RSS";
22976 hunk ./lib/personal.php 118
22977 - case 'repliesrss':
22978 - $feed_classname = $feed['type'];
22979 - $feed_mimetype = "application/".$feed['type']."+xml";
22980 - $feed_title = $feed['version']." feed for replies to $nickname";
22981 - $feed['textContent'] = "RSS";
22983 + case 'repliesrss':
22984 + $feed_classname = $feed['type'];
22985 + $feed_mimetype = "application/".$feed['type']."+xml";
22986 + $feed_title = $feed['version']." feed for replies to $nickname";
22987 + $feed['textContent'] = "RSS";
22989 hunk ./lib/personal.php 125
22990 - case 'publicrss':
22991 - $feed_classname = $feed['type'];
22992 - $feed_mimetype = "application/".$feed['type']."+xml";
22993 - $feed_title = "Public timeline ".$feed['version']." feed";
22994 - $feed['textContent'] = "RSS";
22996 + case 'publicrss':
22997 + $feed_classname = $feed['type'];
22998 + $feed_mimetype = "application/".$feed['type']."+xml";
22999 + $feed_title = "Public timeline ".$feed['version']." feed";
23000 + $feed['textContent'] = "RSS";
23002 hunk ./lib/personal.php 132
23003 - case 'publicatom':
23004 - $feed_classname = "atom";
23005 - $feed_mimetype = "application/".$feed['type']."+xml";
23006 - $feed_title = "Public timeline ".$feed['version']." feed";
23007 - $feed['textContent'] = "Atom";
23009 + case 'publicatom':
23010 + $feed_classname = "atom";
23011 + $feed_mimetype = "application/".$feed['type']."+xml";
23012 + $feed_title = "Public timeline ".$feed['version']." feed";
23013 + $feed['textContent'] = "Atom";
23015 hunk ./lib/personal.php 139
23017 - $feed_classname = $feed['type'];
23018 - $feed_mimetype = "application/".$feed['type']."+xml";
23019 - $feed_title = $feed['version']." feed for this tag";
23020 - $feed['textContent'] = "RSS";
23023 + $feed_classname = $feed['type'];
23024 + $feed_mimetype = "application/".$feed['type']."+xml";
23025 + $feed_title = $feed['version']." feed for this tag";
23026 + $feed['textContent'] = "RSS";
23028 hunk ./lib/personal.php 146
23029 - case 'favoritedrss':
23030 - $feed_classname = $feed['type'];
23031 - $feed_mimetype = "application/".$feed['type']."+xml";
23032 - $feed_title = "Favorited ".$feed['version']." feed";
23033 - $feed['textContent'] = "RSS";
23035 + case 'favoritedrss':
23036 + $feed_classname = $feed['type'];
23037 + $feed_mimetype = "application/".$feed['type']."+xml";
23038 + $feed_title = "Favorited ".$feed['version']." feed";
23039 + $feed['textContent'] = "RSS";
23041 hunk ./lib/personal.php 153
23043 - $feed_classname = "foaf";
23044 - $feed_mimetype = "application/".$feed['type']."+xml";
23045 - $feed_title = "$nickname's FOAF file";
23046 - $feed['textContent'] = "FOAF";
23049 + $feed_classname = "foaf";
23050 + $feed_mimetype = "application/".$feed['type']."+xml";
23051 + $feed_title = "$nickname's FOAF file";
23052 + $feed['textContent'] = "FOAF";
23054 hunk ./lib/personal.php 160
23055 - case 'favoritesrss':
23056 - $feed_classname = "favorites";
23057 - $feed_mimetype = "application/".$feed['type']."+xml";
23058 - $feed_title = "Feed for favorites of $nickname";
23059 - $feed['textContent'] = "RSS";
23061 + case 'favoritesrss':
23062 + $feed_classname = "favorites";
23063 + $feed_mimetype = "application/".$feed['type']."+xml";
23064 + $feed_title = "Feed for favorites of $nickname";
23065 + $feed['textContent'] = "RSS";
23067 hunk ./lib/personal.php 167
23068 - case 'usertimeline':
23069 - $feed_classname = "atom";
23070 - $feed_mimetype = "application/".$feed['type']."+xml";
23071 - $feed_title = "$nickname's ".$feed['version']." notice feed";
23072 - $feed['textContent'] = "Atom";
23075 - common_element_start('li');
23076 - common_element('a', array('href' => $feed['href'],
23077 - 'class' => $feed_classname,
23078 - 'type' => $feed_mimetype,
23079 - 'title' => $feed_title),
23080 - $feed['textContent']);
23081 - common_element_end('li');
23083 + case 'usertimeline':
23084 + $feed_classname = "atom";
23085 + $feed_mimetype = "application/".$feed['type']."+xml";
23086 + $feed_title = "$nickname's ".$feed['version']." notice feed";
23087 + $feed['textContent'] = "Atom";
23090 + common_element_start('li');
23091 + common_element('a', array('href' => $feed['href'],
23092 + 'class' => $feed_classname,
23093 + 'type' => $feed_mimetype,
23094 + 'title' => $feed_title),
23095 + $feed['textContent']);
23096 + common_element_end('li');
23098 hunk ./lib/personal.php 183
23100 - function source_link($source) {
23101 - $source_name = _($source);
23102 - switch ($source) {
23108 - common_element('span', 'noticesource', $source_name);
23111 - $ns = Notice_source::staticGet($source);
23113 - common_element('a', array('href' => $ns->url),
23116 - common_element('span', 'noticesource', $source_name);
23123 + function source_link($source) {
23124 + $source_name = _($source);
23125 + switch ($source) {
23131 + common_element('span', 'noticesource', $source_name);
23134 + $ns = Notice_source::staticGet($source);
23136 + common_element('a', array('href' => $ns->url),
23139 + common_element('span', 'noticesource', $source_name);
23145 hunk ./lib/profilelist.php 27
23146 - var $profile = NULL;
23147 - var $owner = NULL;
23148 - var $action = NULL;
23149 + var $profile = NULL;
23150 + var $owner = NULL;
23151 + var $action = NULL;
23152 hunk ./lib/profilelist.php 31
23153 - function __construct($profile, $owner=NULL, $action=NULL) {
23154 - $this->profile = $profile;
23155 - $this->owner = $owner;
23156 - $this->action = $action;
23158 + function __construct($profile, $owner=NULL, $action=NULL) {
23159 + $this->profile = $profile;
23160 + $this->owner = $owner;
23161 + $this->action = $action;
23163 hunk ./lib/profilelist.php 37
23164 - function show_list() {
23165 + function show_list() {
23166 hunk ./lib/profilelist.php 39
23167 - common_element_start('ul', array('id' => 'profiles', 'class' => 'profile_list'));
23168 + common_element_start('ul', array('id' => 'profiles', 'class' => 'profile_list'));
23169 hunk ./lib/profilelist.php 41
23172 hunk ./lib/profilelist.php 43
23173 - while ($this->profile->fetch()) {
23175 - if($cnt > PROFILES_PER_PAGE) {
23180 + while ($this->profile->fetch()) {
23182 + if($cnt > PROFILES_PER_PAGE) {
23187 hunk ./lib/profilelist.php 51
23188 - common_element_end('ul');
23189 + common_element_end('ul');
23190 hunk ./lib/profilelist.php 53
23195 hunk ./lib/profilelist.php 56
23196 - function show() {
23197 + function show() {
23198 hunk ./lib/profilelist.php 58
23199 - common_element_start('li', array('class' => 'profile_single',
23200 - 'id' => 'profile-' . $this->profile->id));
23201 + common_element_start('li', array('class' => 'profile_single',
23202 + 'id' => 'profile-' . $this->profile->id));
23203 hunk ./lib/profilelist.php 61
23204 - $user = common_current_user();
23205 + $user = common_current_user();
23206 hunk ./lib/profilelist.php 63
23207 - if ($user && $user->id != $this->profile->id) {
23208 - # XXX: special-case for user looking at own
23209 - # subscriptions page
23210 - if ($user->isSubscribed($this->profile)) {
23211 - common_unsubscribe_form($this->profile);
23213 - common_subscribe_form($this->profile);
23216 + if ($user && $user->id != $this->profile->id) {
23217 + # XXX: special-case for user looking at own
23218 + # subscriptions page
23219 + if ($user->isSubscribed($this->profile)) {
23220 + common_unsubscribe_form($this->profile);
23222 + common_subscribe_form($this->profile);
23225 hunk ./lib/profilelist.php 73
23226 - $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
23227 - common_element_start('a', array('href' => $this->profile->profileurl));
23228 - common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
23229 - 'class' => 'avatar stream',
23230 - 'width' => AVATAR_STREAM_SIZE,
23231 - 'height' => AVATAR_STREAM_SIZE,
23233 - ($this->profile->fullname) ? $this->profile->fullname :
23234 - $this->profile->nickname));
23235 - common_element_end('a');
23236 - common_element_start('p');
23237 - common_element_start('a', array('href' => $this->profile->profileurl,
23238 - 'class' => 'nickname'));
23239 - common_raw($this->highlight($this->profile->nickname));
23240 - common_element_end('a');
23241 - if ($this->profile->fullname) {
23242 - common_text(' | ');
23243 - common_element_start('span', 'fullname');
23244 - common_raw($this->highlight($this->profile->fullname));
23245 - common_element_end('span');
23247 - if ($this->profile->location) {
23248 - common_text(' | ');
23249 - common_element_start('span', 'location');
23250 - common_raw($this->highlight($this->profile->location));
23251 - common_element_end('span');
23253 - common_element_end('p');
23254 - if ($this->profile->homepage) {
23255 - common_element_start('p', 'website');
23256 - common_element_start('a', array('href' => $this->profile->homepage));
23257 - common_raw($this->highlight($this->profile->homepage));
23258 - common_element_end('a');
23259 - common_element_end('p');
23261 - if ($this->profile->bio) {
23262 - common_element_start('p', 'bio');
23263 - common_raw($this->highlight($this->profile->bio));
23264 - common_element_end('p');
23266 + $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
23267 + common_element_start('a', array('href' => $this->profile->profileurl));
23268 + common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
23269 + 'class' => 'avatar stream',
23270 + 'width' => AVATAR_STREAM_SIZE,
23271 + 'height' => AVATAR_STREAM_SIZE,
23273 + ($this->profile->fullname) ? $this->profile->fullname :
23274 + $this->profile->nickname));
23275 + common_element_end('a');
23276 + common_element_start('p');
23277 + common_element_start('a', array('href' => $this->profile->profileurl,
23278 + 'class' => 'nickname'));
23279 + common_raw($this->highlight($this->profile->nickname));
23280 + common_element_end('a');
23281 + if ($this->profile->fullname) {
23282 + common_text(' | ');
23283 + common_element_start('span', 'fullname');
23284 + common_raw($this->highlight($this->profile->fullname));
23285 + common_element_end('span');
23287 + if ($this->profile->location) {
23288 + common_text(' | ');
23289 + common_element_start('span', 'location');
23290 + common_raw($this->highlight($this->profile->location));
23291 + common_element_end('span');
23293 + common_element_end('p');
23294 + if ($this->profile->homepage) {
23295 + common_element_start('p', 'website');
23296 + common_element_start('a', array('href' => $this->profile->homepage));
23297 + common_raw($this->highlight($this->profile->homepage));
23298 + common_element_end('a');
23299 + common_element_end('p');
23301 + if ($this->profile->bio) {
23302 + common_element_start('p', 'bio');
23303 + common_raw($this->highlight($this->profile->bio));
23304 + common_element_end('p');
23306 hunk ./lib/profilelist.php 114
23307 - # If we're on a list with an owner (subscriptions or subscribers)...
23308 + # If we're on a list with an owner (subscriptions or subscribers)...
23309 hunk ./lib/profilelist.php 116
23310 - if ($this->owner) {
23312 - $tags = Profile_tag::getTags($this->owner->id, $this->profile->id);
23313 + if ($this->owner) {
23315 + $tags = Profile_tag::getTags($this->owner->id, $this->profile->id);
23316 hunk ./lib/profilelist.php 120
23317 - common_element_start('div', 'tags_user');
23318 - common_element_start('dl');
23319 - common_element_start('dt');
23320 - if ($user->id == $this->owner->id) {
23321 - common_element('a', array('href' => common_local_url('tagother',
23322 - array('id' => $this->profile->id))),
23325 - common_text(_('Tags'));
23327 - common_text(":");
23328 - common_element_end('dt');
23329 - common_element_start('dd');
23331 - common_element_start('ul', 'tags xoxo');
23332 - foreach ($tags as $tag) {
23333 - common_element_start('li');
23334 - common_element('a', array('rel' => 'tag',
23335 - 'href' => common_local_url($this->action,
23336 - array('nickname' => $this->owner->nickname,
23337 - 'tag' => $tag))),
23339 - common_element_end('li');
23341 - common_element_end('ul');
23343 - common_text(_('(none)'));
23345 - common_element_end('dd');
23346 - common_element_end('dl');
23347 - common_element_end('div');
23349 + common_element_start('div', 'tags_user');
23350 + common_element_start('dl');
23351 + common_element_start('dt');
23352 + if ($user->id == $this->owner->id) {
23353 + common_element('a', array('href' => common_local_url('tagother',
23354 + array('id' => $this->profile->id))),
23357 + common_text(_('Tags'));
23359 + common_text(":");
23360 + common_element_end('dt');
23361 + common_element_start('dd');
23363 + common_element_start('ul', 'tags xoxo');
23364 + foreach ($tags as $tag) {
23365 + common_element_start('li');
23366 + common_element('a', array('rel' => 'tag',
23367 + 'href' => common_local_url($this->action,
23368 + array('nickname' => $this->owner->nickname,
23369 + 'tag' => $tag))),
23371 + common_element_end('li');
23373 + common_element_end('ul');
23375 + common_text(_('(none)'));
23377 + common_element_end('dd');
23378 + common_element_end('dl');
23379 + common_element_end('div');
23381 hunk ./lib/profilelist.php 157
23382 - common_element_end('li');
23384 + common_element_end('li');
23386 hunk ./lib/profilelist.php 166
23387 - function highlight($text) {
23388 - return htmlspecialchars($text);
23390 + function highlight($text) {
23391 + return htmlspecialchars($text);
23393 hunk ./lib/queuehandler.php 30
23394 - var $_id = 'generic';
23395 + var $_id = 'generic';
23396 hunk ./lib/queuehandler.php 32
23397 - function QueueHandler($id=NULL) {
23399 - $this->set_id($id);
23403 - function class_name() {
23404 - return ucfirst($this->transport()) . 'Handler';
23406 + function QueueHandler($id=NULL) {
23408 + $this->set_id($id);
23412 + function class_name() {
23413 + return ucfirst($this->transport()) . 'Handler';
23415 hunk ./lib/queuehandler.php 42
23416 - function name() {
23417 - return strtolower($this->class_name().'.'.$this->get_id());
23420 - function get_id() {
23421 - return $this->_id;
23423 + function name() {
23424 + return strtolower($this->class_name().'.'.$this->get_id());
23427 + function get_id() {
23428 + return $this->_id;
23430 hunk ./lib/queuehandler.php 50
23431 - function set_id($id) {
23432 - $this->_id = $id;
23435 - function transport() {
23439 - function start() {
23442 - function finish() {
23444 + function set_id($id) {
23445 + $this->_id = $id;
23448 + function transport() {
23452 + function start() {
23455 + function finish() {
23457 hunk ./lib/queuehandler.php 64
23458 - function handle_notice($notice) {
23463 - if (!$this->start()) {
23466 - $this->log(LOG_INFO, 'checking for queued notices');
23467 - $transport = $this->transport();
23469 - $qi = Queue_item::top($transport);
23471 - $this->log(LOG_INFO, 'Got item enqueued '.common_exact_date($qi->created));
23472 - $notice = Notice::staticGet($qi->notice_id);
23474 - $this->log(LOG_INFO, 'broadcasting notice ID = ' . $notice->id);
23475 - # XXX: what to do if broadcast fails?
23476 - $result = $this->handle_notice($notice);
23478 - $this->log(LOG_WARNING, 'Failed broadcast for notice ID = ' . $notice->id);
23480 - $qi->claimed = NULL;
23481 - $qi->update($orig);
23482 - $this->log(LOG_WARNING, 'Abandoned claim for notice ID = ' . $notice->id);
23485 - $this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
23490 - $this->log(LOG_WARNING, 'queue item for notice that does not exist');
23497 - $this->clear_old_claims();
23501 - if (!$this->finish()) {
23506 + function handle_notice($notice) {
23511 + if (!$this->start()) {
23514 + $this->log(LOG_INFO, 'checking for queued notices');
23515 + $transport = $this->transport();
23517 + $qi = Queue_item::top($transport);
23519 + $this->log(LOG_INFO, 'Got item enqueued '.common_exact_date($qi->created));
23520 + $notice = Notice::staticGet($qi->notice_id);
23522 + $this->log(LOG_INFO, 'broadcasting notice ID = ' . $notice->id);
23523 + # XXX: what to do if broadcast fails?
23524 + $result = $this->handle_notice($notice);
23526 + $this->log(LOG_WARNING, 'Failed broadcast for notice ID = ' . $notice->id);
23528 + $qi->claimed = NULL;
23529 + $qi->update($orig);
23530 + $this->log(LOG_WARNING, 'Abandoned claim for notice ID = ' . $notice->id);
23533 + $this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
23538 + $this->log(LOG_WARNING, 'queue item for notice that does not exist');
23545 + $this->clear_old_claims();
23549 + if (!$this->finish()) {
23554 hunk ./lib/queuehandler.php 113
23555 - function idle($timeout=0) {
23556 - if ($timeout>0) {
23561 - function clear_old_claims() {
23562 - $qi = new Queue_item();
23563 - $qi->transport = $this->transport();
23564 - $qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
23565 - $qi->update(DB_DATAOBJECT_WHEREADD_ONLY);
23570 - function log($level, $msg) {
23571 - common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
23573 + function idle($timeout=0) {
23574 + if ($timeout>0) {
23579 + function clear_old_claims() {
23580 + $qi = new Queue_item();
23581 + $qi->transport = $this->transport();
23582 + $qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
23583 + $qi->update(DB_DATAOBJECT_WHEREADD_ONLY);
23588 + function log($level, $msg) {
23589 + common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
23591 hunk ./lib/queuehandler.php 132
23594 hunk ./lib/rssaction.php 26
23595 - # This will contain the details of each feed item's author and be used to generate SIOC data.
23596 - var $creators = array();
23597 + # This will contain the details of each feed item's author and be used to generate SIOC data.
23598 + var $creators = array();
23599 hunk ./lib/rssaction.php 29
23600 - function is_readonly() {
23603 + function is_readonly() {
23606 hunk ./lib/rssaction.php 33
23607 - function handle($args) {
23608 - parent::handle($args);
23609 - $limit = (int) $this->trimmed('limit');
23610 - if ($limit == 0) {
23611 - $limit = DEFAULT_RSS_LIMIT;
23613 - $this->show_rss($limit);
23615 + function handle($args) {
23616 + parent::handle($args);
23617 + $limit = (int) $this->trimmed('limit');
23618 + if ($limit == 0) {
23619 + $limit = DEFAULT_RSS_LIMIT;
23621 + $this->show_rss($limit);
23623 hunk ./lib/rssaction.php 42
23624 - function init() {
23627 + function init() {
23630 hunk ./lib/rssaction.php 46
23631 - function get_notices() {
23634 + function get_notices() {
23637 hunk ./lib/rssaction.php 50
23638 - function get_channel() {
23639 - return array('url' => '',
23642 - 'description' => '');
23644 + function get_channel() {
23645 + return array('url' => '',
23648 + 'description' => '');
23650 hunk ./lib/rssaction.php 57
23651 - function get_image() {
23654 + function get_image() {
23657 hunk ./lib/rssaction.php 61
23658 - function show_rss($limit=0) {
23659 + function show_rss($limit=0) {
23660 hunk ./lib/rssaction.php 63
23661 - if (!$this->init()) {
23664 + if (!$this->init()) {
23667 hunk ./lib/rssaction.php 67
23668 - $notices = $this->get_notices($limit);
23669 + $notices = $this->get_notices($limit);
23670 hunk ./lib/rssaction.php 69
23671 - $this->init_rss();
23672 - $this->show_channel($notices);
23673 - $this->show_image();
23674 + $this->init_rss();
23675 + $this->show_channel($notices);
23676 + $this->show_image();
23677 hunk ./lib/rssaction.php 73
23678 - foreach ($notices as $n) {
23679 - $this->show_item($n);
23681 + foreach ($notices as $n) {
23682 + $this->show_item($n);
23684 hunk ./lib/rssaction.php 77
23685 - $this->show_creators();
23686 - $this->end_rss();
23688 + $this->show_creators();
23689 + $this->end_rss();
23691 hunk ./lib/rssaction.php 81
23692 - function show_channel($notices) {
23693 + function show_channel($notices) {
23694 hunk ./lib/rssaction.php 83
23695 - $channel = $this->get_channel();
23696 - $image = $this->get_image();
23697 + $channel = $this->get_channel();
23698 + $image = $this->get_image();
23699 hunk ./lib/rssaction.php 86
23700 - common_element_start('channel', array('rdf:about' => $channel['url']));
23701 - common_element('title', NULL, $channel['title']);
23702 - common_element('link', NULL, $channel['link']);
23703 - common_element('description', NULL, $channel['description']);
23704 - common_element('cc:licence', array('rdf:resource' => common_config('license','url')));
23705 + common_element_start('channel', array('rdf:about' => $channel['url']));
23706 + common_element('title', NULL, $channel['title']);
23707 + common_element('link', NULL, $channel['link']);
23708 + common_element('description', NULL, $channel['description']);
23709 + common_element('cc:licence', array('rdf:resource' => common_config('license','url')));
23710 hunk ./lib/rssaction.php 92
23712 - common_element('image', array('rdf:resource' => $image));
23715 + common_element('image', array('rdf:resource' => $image));
23717 hunk ./lib/rssaction.php 96
23718 - common_element_start('items');
23719 - common_element_start('rdf:Seq');
23720 + common_element_start('items');
23721 + common_element_start('rdf:Seq');
23722 hunk ./lib/rssaction.php 99
23723 - foreach ($notices as $notice) {
23724 - common_element('sioct:MicroblogPost', array('rdf:resource' => $notice->uri));
23726 + foreach ($notices as $notice) {
23727 + common_element('sioct:MicroblogPost', array('rdf:resource' => $notice->uri));
23729 hunk ./lib/rssaction.php 103
23730 - common_element_end('rdf:Seq');
23731 - common_element_end('items');
23732 + common_element_end('rdf:Seq');
23733 + common_element_end('items');
23734 hunk ./lib/rssaction.php 106
23735 - common_element_end('channel');
23737 + common_element_end('channel');
23739 hunk ./lib/rssaction.php 109
23740 - function show_image() {
23741 - $image = $this->get_image();
23743 - $channel = $this->get_channel();
23744 - common_element_start('image', array('rdf:about' => $image));
23745 - common_element('title', NULL, $channel['title']);
23746 - common_element('link', NULL, $channel['link']);
23747 - common_element('url', NULL, $image);
23748 - common_element_end('image');
23751 + function show_image() {
23752 + $image = $this->get_image();
23754 + $channel = $this->get_channel();
23755 + common_element_start('image', array('rdf:about' => $image));
23756 + common_element('title', NULL, $channel['title']);
23757 + common_element('link', NULL, $channel['link']);
23758 + common_element('url', NULL, $image);
23759 + common_element_end('image');
23762 hunk ./lib/rssaction.php 121
23763 - function show_item($notice) {
23764 - $profile = Profile::staticGet($notice->profile_id);
23765 - $nurl = common_local_url('shownotice', array('notice' => $notice->id));
23766 - $creator_uri = common_profile_uri($profile);
23767 - common_element_start('item', array('rdf:about' => $notice->uri));
23768 - $title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
23769 - common_element('title', NULL, $title);
23770 - common_element('link', NULL, $nurl);
23771 - common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
23772 - common_element('dc:date', NULL, common_date_w3dtf($notice->created));
23773 - common_element('dc:creator', NULL, ($profile->fullname) ? $profile->fullname : $profile->nickname);
23774 - common_element('sioc:has_creator', array('rdf:resource' => $creator_uri));
23775 - common_element('laconica:postIcon', array('rdf:resource' => common_profile_avatar_url($profile)));
23776 - common_element('cc:licence', array('rdf:resource' => common_config('license', 'url')));
23777 - common_element_end('item');
23778 - $this->creators[$creator_uri] = $profile;
23780 + function show_item($notice) {
23781 + $profile = Profile::staticGet($notice->profile_id);
23782 + $nurl = common_local_url('shownotice', array('notice' => $notice->id));
23783 + $creator_uri = common_profile_uri($profile);
23784 + common_element_start('item', array('rdf:about' => $notice->uri));
23785 + $title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
23786 + common_element('title', NULL, $title);
23787 + common_element('link', NULL, $nurl);
23788 + common_element('description', NULL, $profile->nickname."'s status on ".common_exact_date($notice->created));
23789 + common_element('dc:date', NULL, common_date_w3dtf($notice->created));
23790 + common_element('dc:creator', NULL, ($profile->fullname) ? $profile->fullname : $profile->nickname);
23791 + common_element('sioc:has_creator', array('rdf:resource' => $creator_uri));
23792 + common_element('laconica:postIcon', array('rdf:resource' => common_profile_avatar_url($profile)));
23793 + common_element('cc:licence', array('rdf:resource' => common_config('license', 'url')));
23794 + common_element_end('item');
23795 + $this->creators[$creator_uri] = $profile;
23797 hunk ./lib/rssaction.php 139
23798 - function show_creators() {
23799 - foreach ($this->creators as $uri => $profile) {
23800 - $id = $profile->id;
23801 - $nickname = $profile->nickname;
23802 - common_element_start('sioc:User', array('rdf:about' => $uri));
23803 - common_element('foaf:nick', NULL, $nickname);
23804 - if ($profile->fullname) {
23805 - common_element('foaf:name', NULL, $profile->fullname);
23807 - common_element('sioc:id', NULL, $id);
23808 - $avatar = common_profile_avatar_url($profile);
23809 - common_element('sioc:avatar', array('rdf:resource' => $avatar));
23810 - common_element_end('sioc:User');
23813 + function show_creators() {
23814 + foreach ($this->creators as $uri => $profile) {
23815 + $id = $profile->id;
23816 + $nickname = $profile->nickname;
23817 + common_element_start('sioc:User', array('rdf:about' => $uri));
23818 + common_element('foaf:nick', NULL, $nickname);
23819 + if ($profile->fullname) {
23820 + common_element('foaf:name', NULL, $profile->fullname);
23822 + common_element('sioc:id', NULL, $id);
23823 + $avatar = common_profile_avatar_url($profile);
23824 + common_element('sioc:avatar', array('rdf:resource' => $avatar));
23825 + common_element_end('sioc:User');
23828 hunk ./lib/rssaction.php 155
23829 - function init_rss() {
23830 - $channel = $this->get_channel();
23831 - header('Content-Type: application/rdf+xml');
23832 + function init_rss() {
23833 + $channel = $this->get_channel();
23834 + header('Content-Type: application/rdf+xml');
23835 hunk ./lib/rssaction.php 159
23836 - common_start_xml();
23837 - common_element_start('rdf:RDF', array('xmlns:rdf' =>
23838 - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
23840 - 'http://purl.org/dc/elements/1.1/',
23842 - 'http://web.resource.org/cc/',
23843 + common_start_xml();
23844 + common_element_start('rdf:RDF', array('xmlns:rdf' =>
23845 + 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
23847 + 'http://purl.org/dc/elements/1.1/',
23849 + 'http://web.resource.org/cc/',
23850 hunk ./lib/rssaction.php 168
23852 - 'http://xmlns.com/foaf/0.1/',
23854 - 'http://rdfs.org/sioc/ns#',
23856 - 'http://rdfs.org/sioc/types#',
23857 - 'xmlns:laconica' =>
23858 - 'http://laconi.ca/ont/',
23859 - 'xmlns' => 'http://purl.org/rss/1.0/'));
23860 - common_element_start('sioc:Site', array('rdf:about' => common_root_url()));
23861 - common_element('sioc:name', NULL, common_config('site', 'name'));
23862 - common_element_start('sioc:container_of');
23863 - common_element('sioc:Container', array('rdf:about' =>
23864 - $channel['url']));
23865 - common_element_end('sioc:container_of');
23866 - common_element_end('sioc:Site');
23869 + 'http://xmlns.com/foaf/0.1/',
23871 + 'http://rdfs.org/sioc/ns#',
23873 + 'http://rdfs.org/sioc/types#',
23874 + 'xmlns:laconica' =>
23875 + 'http://laconi.ca/ont/',
23876 + 'xmlns' => 'http://purl.org/rss/1.0/'));
23877 + common_element_start('sioc:Site', array('rdf:about' => common_root_url()));
23878 + common_element('sioc:name', NULL, common_config('site', 'name'));
23879 + common_element_start('sioc:container_of');
23880 + common_element('sioc:Container', array('rdf:about' =>
23881 + $channel['url']));
23882 + common_element_end('sioc:container_of');
23883 + common_element_end('sioc:Site');
23885 hunk ./lib/rssaction.php 186
23886 - function end_rss() {
23887 - common_element_end('rdf:RDF');
23889 + function end_rss() {
23890 + common_element_end('rdf:RDF');
23892 hunk ./lib/search_engines.php 101
23893 - 'against (\''.addslashes($q).'\')');
23894 + 'against (\''.addslashes($q).'\')');
23895 hunk ./lib/search_engines.php 104
23896 - 'against (\''.addslashes($q).'\')');
23897 + 'against (\''.addslashes($q).'\')');
23898 hunk ./lib/searchaction.php 24
23899 - function is_readonly() {
23902 + function is_readonly() {
23905 hunk ./lib/searchaction.php 28
23906 - function handle($args) {
23907 - parent::handle($args);
23908 - $this->show_form();
23910 + function handle($args) {
23911 + parent::handle($args);
23912 + $this->show_form();
23914 hunk ./lib/searchaction.php 33
23915 - function show_top($arr=NULL) {
23917 - $error = $arr[1];
23920 - common_element('p', 'error', $error);
23922 - $instr = $this->get_instructions();
23923 - $output = common_markup_to_html($instr);
23924 - common_element_start('div', 'instructions');
23925 - common_raw($output);
23926 - common_element_end('div');
23928 - $this->search_menu();
23930 + function show_top($arr=NULL) {
23932 + $error = $arr[1];
23935 + common_element('p', 'error', $error);
23937 + $instr = $this->get_instructions();
23938 + $output = common_markup_to_html($instr);
23939 + common_element_start('div', 'instructions');
23940 + common_raw($output);
23941 + common_element_end('div');
23943 + $this->search_menu();
23945 hunk ./lib/searchaction.php 49
23946 - function get_title() {
23949 + function get_title() {
23952 hunk ./lib/searchaction.php 53
23953 - function show_header($arr) {
23956 + function show_header($arr) {
23959 hunk ./lib/searchaction.php 57
23960 - function show_form($error=NULL) {
23962 + function show_form($error=NULL) {
23964 hunk ./lib/searchaction.php 60
23965 - $q = $this->trimmed('q');
23966 - $page = $this->trimmed('page', 1);
23967 + $q = $this->trimmed('q');
23968 + $page = $this->trimmed('page', 1);
23969 hunk ./lib/searchaction.php 63
23970 - common_show_header($this->get_title(), array($this, 'show_header'), array($q, $error),
23971 - array($this, 'show_top'));
23972 - common_element_start('form', array('method' => 'get',
23974 - 'action' => common_local_url($this->trimmed('action'))));
23975 - common_element_start('p');
23976 - if (!isset($config['site']['fancy']) || !$config['site']['fancy']) {
23977 - common_element('input', array('name' => 'action',
23978 - 'type' => 'hidden',
23979 - 'value' => $this->trimmed('action')));
23981 - common_element('input', array('name' => 'q',
23983 - 'type' => 'text',
23984 - 'class' => 'input_text',
23985 - 'value' => ($q) ? $q : ''));
23986 - common_text(' ');
23987 - common_element('input', array('type' => 'submit',
23988 - 'id' => 'search',
23989 - 'name' => 'search',
23990 - 'class' => 'submit',
23991 - 'value' => _('Search')));
23992 + common_show_header($this->get_title(), array($this, 'show_header'), array($q, $error),
23993 + array($this, 'show_top'));
23994 + common_element_start('form', array('method' => 'get',
23996 + 'action' => common_local_url($this->trimmed('action'))));
23997 + common_element_start('p');
23998 + if (!isset($config['site']['fancy']) || !$config['site']['fancy']) {
23999 + common_element('input', array('name' => 'action',
24000 + 'type' => 'hidden',
24001 + 'value' => $this->trimmed('action')));
24003 + common_element('input', array('name' => 'q',
24005 + 'type' => 'text',
24006 + 'class' => 'input_text',
24007 + 'value' => ($q) ? $q : ''));
24008 + common_text(' ');
24009 + common_element('input', array('type' => 'submit',
24010 + 'id' => 'search',
24011 + 'name' => 'search',
24012 + 'class' => 'submit',
24013 + 'value' => _('Search')));
24014 hunk ./lib/searchaction.php 86
24015 - common_element_end('p');
24016 - common_element_end('form');
24018 - $this->show_results($q, $page);
24020 - common_show_footer();
24022 + common_element_end('p');
24023 + common_element_end('form');
24025 + $this->show_results($q, $page);
24027 + common_show_footer();
24029 hunk ./lib/searchaction.php 94
24030 - function search_menu() {
24031 - # action => array('prompt', 'title', $args)
24032 - $action = $this->trimmed('action');
24034 - array('peoplesearch' =>
24037 - _('Find people on this site'),
24038 - ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL),
24039 - 'noticesearch' =>
24040 - array( _('Text'),
24041 - _('Find content of notices'),
24042 - ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL)
24044 - $this->nav_menu($menu);
24046 + function search_menu() {
24047 + # action => array('prompt', 'title', $args)
24048 + $action = $this->trimmed('action');
24050 + array('peoplesearch' =>
24053 + _('Find people on this site'),
24054 + ($action != 'peoplesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL),
24055 + 'noticesearch' =>
24056 + array( _('Text'),
24057 + _('Find content of notices'),
24058 + ($action != 'noticesearch' && $this->trimmed('q')) ? array('q' => $this->trimmed('q')) : NULL)
24060 + $this->nav_menu($menu);
24062 hunk ./lib/settingsaction.php 30
24063 - # Cookie theft means that automatic logins can't
24064 - # change important settings or see private info, and
24065 - # _all_ our settings are important
24066 + # Cookie theft means that automatic logins can't
24067 + # change important settings or see private info, and
24068 + # _all_ our settings are important
24069 hunk ./lib/settingsaction.php 58
24070 - function form_header($title, $msg=NULL, $success=false) {
24071 - common_show_header($title,
24073 - array($msg, $success),
24074 - array($this, 'show_top'));
24076 + function form_header($title, $msg=NULL, $success=false) {
24077 + common_show_header($title,
24079 + array($msg, $success),
24080 + array($this, 'show_top'));
24082 hunk ./lib/settingsaction.php 65
24083 - function show_top($arr) {
24085 - $success = $arr[1];
24087 - $this->message($msg, $success);
24089 - $inst = $this->get_instructions();
24090 - $output = common_markup_to_html($inst);
24091 - common_element_start('div', 'instructions');
24092 - common_raw($output);
24093 - common_element_end('div');
24095 - $this->settings_menu();
24097 + function show_top($arr) {
24099 + $success = $arr[1];
24101 + $this->message($msg, $success);
24103 + $inst = $this->get_instructions();
24104 + $output = common_markup_to_html($inst);
24105 + common_element_start('div', 'instructions');
24106 + common_raw($output);
24107 + common_element_end('div');
24109 + $this->settings_menu();
24111 hunk ./lib/settingsaction.php 82
24113 - array('profilesettings' =>
24114 - array(_('Profile'),
24115 - _('Change your profile settings')),
24116 - 'emailsettings' =>
24117 - array(_('Email'),
24118 - _('Change email handling')),
24119 - 'openidsettings' =>
24120 - array(_('OpenID'),
24121 - _('Add or remove OpenIDs')),
24124 - _('Updates by SMS')),
24127 - _('Updates by instant messenger (IM)')),
24128 - 'twittersettings' =>
24129 - array(_('Twitter'),
24130 - _('Twitter integration options')),
24131 - 'othersettings' =>
24132 - array(_('Other'),
24133 - _('Other options')));
24136 + array('profilesettings' =>
24137 + array(_('Profile'),
24138 + _('Change your profile settings')),
24139 + 'emailsettings' =>
24140 + array(_('Email'),
24141 + _('Change email handling')),
24142 + 'openidsettings' =>
24143 + array(_('OpenID'),
24144 + _('Add or remove OpenIDs')),
24147 + _('Updates by SMS')),
24150 + _('Updates by instant messenger (IM)')),
24151 + 'twittersettings' =>
24152 + array(_('Twitter'),
24153 + _('Twitter integration options')),
24154 + 'othersettings' =>
24155 + array(_('Other'),
24156 + _('Other options')));
24158 hunk ./lib/settingsaction.php 108
24159 - if ($menuaction == 'imsettings' &&
24160 - !common_config('xmpp', 'enabled')) {
24163 + if ($menuaction == 'imsettings' &&
24164 + !common_config('xmpp', 'enabled')) {
24167 hunk ./lib/stream.php 13
24168 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24169 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24170 hunk ./lib/stream.php 17
24171 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
24172 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
24173 hunk ./lib/stream.php 27
24174 - function public_views_menu() {
24175 + function public_views_menu() {
24176 hunk ./lib/stream.php 29
24177 - $action = $this->trimmed('action');
24178 + $action = $this->trimmed('action');
24179 hunk ./lib/stream.php 31
24180 - common_element_start('ul', array('id' => 'nav_views'));
24181 + common_element_start('ul', array('id' => 'nav_views'));
24182 hunk ./lib/stream.php 33
24183 - common_menu_item(common_local_url('public'), _('Public'),
24184 - _('Public timeline'), $action == 'public');
24185 + common_menu_item(common_local_url('public'), _('Public'),
24186 + _('Public timeline'), $action == 'public');
24187 hunk ./lib/stream.php 36
24188 - common_menu_item(common_local_url('tag'), _('Recent tags'),
24189 - _('Recent tags'), $action == 'tag');
24190 + common_menu_item(common_local_url('tag'), _('Recent tags'),
24191 + _('Recent tags'), $action == 'tag');
24192 hunk ./lib/stream.php 39
24193 - if (count(common_config('nickname', 'featured')) > 0) {
24194 - common_menu_item(common_local_url('featured'), _('Featured'),
24195 - _('Featured users'), $action == 'featured');
24197 + if (count(common_config('nickname', 'featured')) > 0) {
24198 + common_menu_item(common_local_url('featured'), _('Featured'),
24199 + _('Featured users'), $action == 'featured');
24201 hunk ./lib/stream.php 44
24202 - common_menu_item(common_local_url('favorited'), _('Popular'),
24203 - _("Popular notices"), $action == 'favorited');
24204 + common_menu_item(common_local_url('favorited'), _('Popular'),
24205 + _("Popular notices"), $action == 'favorited');
24206 hunk ./lib/stream.php 47
24207 - common_element_end('ul');
24208 + common_element_end('ul');
24209 hunk ./lib/stream.php 49
24212 hunk ./lib/subs.php 30
24213 - $other = User::staticGet('nickname', $other_nickname);
24214 + $other = User::staticGet('nickname', $other_nickname);
24215 hunk ./lib/subs.php 32
24217 - return _('No such user.');
24220 + return _('No such user.');
24222 hunk ./lib/subs.php 36
24223 - return subs_subscribe_to($user, $other);
24224 + return subs_subscribe_to($user, $other);
24225 hunk ./lib/subs.php 46
24226 - if ($user->isSubscribed($other)) {
24227 - return _('Already subscribed!.');
24229 + if ($user->isSubscribed($other)) {
24230 + return _('Already subscribed!.');
24232 hunk ./lib/subs.php 51
24233 - return _('User has blocked you.');
24234 + return _('User has blocked you.');
24235 hunk ./lib/subs.php 54
24236 - if (!$user->subscribeTo($other)) {
24237 - return _('Could not subscribe.');
24240 + if (!$user->subscribeTo($other)) {
24241 + return _('Could not subscribe.');
24244 hunk ./lib/subs.php 61
24245 - if (common_config('memcached', 'enabled')) {
24246 - $cache = new Memcache();
24247 - if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
24248 - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
24251 + if (common_config('memcached', 'enabled')) {
24252 + $cache = new Memcache();
24253 + if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
24254 + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
24257 hunk ./lib/subs.php 68
24258 - if ($other->autosubscribe && !$other->isSubscribed($user) && !$user->hasBlocked($other)) {
24259 - if (!$other->subscribeTo($user)) {
24260 - return _('Could not subscribe other to you.');
24262 - if (common_config('memcached', 'enabled')) {
24263 - $cache = new Memcache();
24264 - if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
24265 - $cache->delete(common_cache_key('user:notices_with_friends:' . $other->id));
24268 + if ($other->autosubscribe && !$other->isSubscribed($user) && !$user->hasBlocked($other)) {
24269 + if (!$other->subscribeTo($user)) {
24270 + return _('Could not subscribe other to you.');
24272 + if (common_config('memcached', 'enabled')) {
24273 + $cache = new Memcache();
24274 + if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
24275 + $cache->delete(common_cache_key('user:notices_with_friends:' . $other->id));
24278 hunk ./lib/subs.php 79
24279 - subs_notify($user, $other);
24281 + subs_notify($user, $other);
24283 hunk ./lib/subs.php 82
24286 hunk ./lib/subs.php 86
24287 - # XXX: add other notifications (Jabber, SMS) here
24288 - # XXX: queue this and handle it offline
24289 - # XXX: Whatever happens, do it in Twitter-like API, too
24290 - subs_notify_email($listenee, $listener);
24291 + # XXX: add other notifications (Jabber, SMS) here
24292 + # XXX: queue this and handle it offline
24293 + # XXX: Whatever happens, do it in Twitter-like API, too
24294 + subs_notify_email($listenee, $listener);
24295 hunk ./lib/subs.php 93
24296 - mail_subscribe_notify($listenee, $listener);
24297 + mail_subscribe_notify($listenee, $listener);
24298 hunk ./lib/subs.php 102
24299 - $other = User::staticGet('nickname', $other_nickname);
24300 + $other = User::staticGet('nickname', $other_nickname);
24301 hunk ./lib/subs.php 104
24303 - return _('No such user.');
24306 + return _('No such user.');
24308 hunk ./lib/subs.php 108
24309 - return subs_unsubscribe_to($user, $other->getProfile());
24310 + return subs_unsubscribe_to($user, $other->getProfile());
24311 hunk ./lib/subs.php 116
24312 - if (!$user->isSubscribed($other))
24313 - return _('Not subscribed!.');
24314 + if (!$user->isSubscribed($other))
24315 + return _('Not subscribed!.');
24316 hunk ./lib/subs.php 119
24317 - $sub = DB_DataObject::factory('subscription');
24318 + $sub = DB_DataObject::factory('subscription');
24319 hunk ./lib/subs.php 121
24320 - $sub->subscriber = $user->id;
24321 - $sub->subscribed = $other->id;
24322 + $sub->subscriber = $user->id;
24323 + $sub->subscribed = $other->id;
24324 hunk ./lib/subs.php 124
24325 - $sub->find(true);
24326 + $sub->find(true);
24327 hunk ./lib/subs.php 126
24328 - // note we checked for existence above
24329 + // note we checked for existence above
24330 hunk ./lib/subs.php 128
24331 - if (!$sub->delete())
24332 - return _('Couldn\'t delete subscription.');
24333 + if (!$sub->delete())
24334 + return _('Couldn\'t delete subscription.');
24335 hunk ./lib/subs.php 131
24336 - if (common_config('memcached', 'enabled')) {
24337 - $cache = new Memcache();
24338 - if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
24339 - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
24342 + if (common_config('memcached', 'enabled')) {
24343 + $cache = new Memcache();
24344 + if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
24345 + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
24348 hunk ./lib/subs.php 138
24351 hunk ./lib/theme.php 23
24352 - $theme = common_config('site', 'theme');
24353 - return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
24354 + $theme = common_config('site', 'theme');
24355 + return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
24356 hunk ./lib/theme.php 28
24357 - $theme = common_config('site', 'theme');
24358 - $server = common_config('theme', 'server');
24360 - return 'http://'.$server.'/'.$theme.'/'.$relative;
24362 - return common_path('theme/'.$theme.'/'.$relative);
24364 + $theme = common_config('site', 'theme');
24365 + $server = common_config('theme', 'server');
24367 + return 'http://'.$server.'/'.$theme.'/'.$relative;
24369 + return common_path('theme/'.$theme.'/'.$relative);
24371 hunk ./lib/twitter.php 24
24372 - $options = array(
24373 - CURLOPT_USERPWD => sprintf("%s:%s", $screen_name, $password),
24374 - CURLOPT_RETURNTRANSFER => true,
24375 - CURLOPT_FAILONERROR => true,
24376 - CURLOPT_HEADER => false,
24377 - CURLOPT_FOLLOWLOCATION => true,
24378 - // CURLOPT_USERAGENT => "identi.ca",
24379 - CURLOPT_CONNECTTIMEOUT => 120,
24380 - CURLOPT_TIMEOUT => 120
24382 + $options = array(
24383 + CURLOPT_USERPWD => sprintf("%s:%s", $screen_name, $password),
24384 + CURLOPT_RETURNTRANSFER => true,
24385 + CURLOPT_FAILONERROR => true,
24386 + CURLOPT_HEADER => false,
24387 + CURLOPT_FOLLOWLOCATION => true,
24388 + // CURLOPT_USERAGENT => "identi.ca",
24389 + CURLOPT_CONNECTTIMEOUT => 120,
24390 + CURLOPT_TIMEOUT => 120
24392 hunk ./lib/twitter.php 36
24393 - $ch = curl_init($uri);
24394 + $ch = curl_init($uri);
24395 hunk ./lib/twitter.php 41
24397 - common_debug("Twitter bridge - cURL error: $errmsg - trying to load: $uri with user $twit_user.",
24401 + common_debug("Twitter bridge - cURL error: $errmsg - trying to load: $uri with user $twit_user.",
24404 hunk ./lib/twitter.php 46
24407 hunk ./lib/twitter.php 48
24410 hunk ./lib/twitter.php 53
24411 - $uri = "http://twitter.com/users/show/$screen_name.json";
24412 - $data = get_twitter_data($uri, $screen_name, $password);
24413 + $uri = "http://twitter.com/users/show/$screen_name.json";
24414 + $data = get_twitter_data($uri, $screen_name, $password);
24415 hunk ./lib/twitter.php 56
24422 hunk ./lib/twitter.php 60
24423 - $twit_user = json_decode($data);
24424 + $twit_user = json_decode($data);
24425 hunk ./lib/twitter.php 62
24426 - if (!$twit_user) {
24429 + if (!$twit_user) {
24432 hunk ./lib/twitter.php 66
24433 - return $twit_user;
24434 + return $twit_user;
24435 hunk ./lib/twitter.php 71
24436 - $original = clone($fuser);
24437 - $fuser->nickname = $screen_name;
24438 - $fuser->uri = 'http://twitter.com/' . $screen_name;
24439 - $result = $fuser->updateKeys($original);
24440 + $original = clone($fuser);
24441 + $fuser->nickname = $screen_name;
24442 + $fuser->uri = 'http://twitter.com/' . $screen_name;
24443 + $result = $fuser->updateKeys($original);
24444 hunk ./lib/twitter.php 76
24446 - common_log_db_error($fuser, 'UPDATE', __FILE__);
24450 + common_log_db_error($fuser, 'UPDATE', __FILE__);
24453 hunk ./lib/twitter.php 81
24456 hunk ./lib/twitter.php 86
24457 - // Otherwise, create a new Twitter user
24458 - $fuser = DB_DataObject::factory('foreign_user');
24459 + // Otherwise, create a new Twitter user
24460 + $fuser = DB_DataObject::factory('foreign_user');
24461 hunk ./lib/twitter.php 89
24462 - $fuser->nickname = $screen_name;
24463 - $fuser->uri = 'http://twitter.com/' . $screen_name;
24464 - $fuser->id = $twitter_id;
24465 - $fuser->service = 1; // Twitter
24466 - $fuser->created = common_sql_now();
24467 - $result = $fuser->insert();
24468 + $fuser->nickname = $screen_name;
24469 + $fuser->uri = 'http://twitter.com/' . $screen_name;
24470 + $fuser->id = $twitter_id;
24471 + $fuser->service = 1; // Twitter
24472 + $fuser->created = common_sql_now();
24473 + $result = $fuser->insert();
24474 hunk ./lib/twitter.php 96
24476 - common_debug("Twitter bridge - failed to add new Twitter user: $twitter_id - $screen_name.");
24477 - common_log_db_error($fuser, 'INSERT', __FILE__);
24481 + common_debug("Twitter bridge - failed to add new Twitter user: $twitter_id - $screen_name.");
24482 + common_log_db_error($fuser, 'INSERT', __FILE__);
24485 hunk ./lib/twitter.php 102
24486 - common_debug("Twitter bridge - Added new Twitter user: $screen_name ($twitter_id).");
24487 + common_debug("Twitter bridge - Added new Twitter user: $screen_name ($twitter_id).");
24488 hunk ./lib/twitter.php 104
24491 hunk ./lib/twitter.php 110
24492 - // Check to see whether the Twitter user is already in the system,
24493 - // and update its screen name and uri if so.
24494 - $fuser = Foreign_user::getForeignUser($twitter_id, 1);
24495 + // Check to see whether the Twitter user is already in the system,
24496 + // and update its screen name and uri if so.
24497 + $fuser = Foreign_user::getForeignUser($twitter_id, 1);
24498 hunk ./lib/twitter.php 114
24501 hunk ./lib/twitter.php 116
24502 - // Only update if Twitter screen name has changed
24503 - if ($fuser->nickname != $screen_name) {
24504 + // Only update if Twitter screen name has changed
24505 + if ($fuser->nickname != $screen_name) {
24506 hunk ./lib/twitter.php 119
24507 - common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' .
24508 - "$fuser->id to $screen_name, was $fuser->nickname");
24509 + common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' .
24510 + "$fuser->id to $screen_name, was $fuser->nickname");
24511 hunk ./lib/twitter.php 122
24512 - return update_twitter_user($fuser, $twitter_id, $screen_name);
24514 + return update_twitter_user($fuser, $twitter_id, $screen_name);
24516 hunk ./lib/twitter.php 125
24518 - return add_twitter_user($twitter_id, $screen_name);
24521 + return add_twitter_user($twitter_id, $screen_name);
24523 hunk ./lib/twitter.php 129
24526 hunk ./lib/twitter.php 134
24527 - $uri = "http://twitter.com/statuses/friends/$twitter_id.json?page=";
24528 - $twitter_user = twitter_user_info($screen_name, $password);
24529 + $uri = "http://twitter.com/statuses/friends/$twitter_id.json?page=";
24530 + $twitter_user = twitter_user_info($screen_name, $password);
24531 hunk ./lib/twitter.php 137
24532 - // Calculate how many pages to get...
24533 - $pages = ceil($twitter_user->friends_count / 100);
24534 + // Calculate how many pages to get...
24535 + $pages = ceil($twitter_user->friends_count / 100);
24536 hunk ./lib/twitter.php 140
24537 - if ($pages == 0) {
24538 - common_debug("Twitter bridge - Twitter user $screen_name has no friends! Lame.");
24540 + if ($pages == 0) {
24541 + common_debug("Twitter bridge - Twitter user $screen_name has no friends! Lame.");
24543 hunk ./lib/twitter.php 144
24544 - $friends = array();
24545 + $friends = array();
24546 hunk ./lib/twitter.php 146
24547 - for ($i = 1; $i <= $pages; $i++) {
24548 + for ($i = 1; $i <= $pages; $i++) {
24549 hunk ./lib/twitter.php 148
24550 - $data = get_twitter_data($uri . $i, $screen_name, $password);
24551 + $data = get_twitter_data($uri . $i, $screen_name, $password);
24552 hunk ./lib/twitter.php 150
24559 hunk ./lib/twitter.php 154
24560 - $more_friends = json_decode($data);
24561 + $more_friends = json_decode($data);
24562 hunk ./lib/twitter.php 156
24563 - if (!$more_friends) {
24566 + if (!$more_friends) {
24569 hunk ./lib/twitter.php 160
24570 - $friends = array_merge($friends, $more_friends);
24572 + $friends = array_merge($friends, $more_friends);
24574 hunk ./lib/twitter.php 163
24577 hunk ./lib/twitter.php 168
24578 - $friends = retreive_twitter_friends($twitter_id, $screen_name, $password);
24579 + $friends = retreive_twitter_friends($twitter_id, $screen_name, $password);
24580 hunk ./lib/twitter.php 170
24581 - if (is_null($friends)) {
24582 - common_debug("Twitter bridge - Couldn't get friends data from Twitter.");
24585 + if (is_null($friends)) {
24586 + common_debug("Twitter bridge - Couldn't get friends data from Twitter.");
24589 hunk ./lib/twitter.php 177
24590 - $friend_name = $friend->screen_name;
24591 - $friend_id = $friend->id;
24592 + $friend_name = $friend->screen_name;
24593 + $friend_id = $friend->id;
24594 hunk ./lib/twitter.php 180
24595 - // Update or create the Foreign_user record
24596 - if (!save_twitter_user($friend_id, $friend_name)) {
24599 + // Update or create the Foreign_user record
24600 + if (!save_twitter_user($friend_id, $friend_name)) {
24603 hunk ./lib/twitter.php 185
24604 - // Check to see if there's a related local user
24605 - $flink = Foreign_link::getByForeignID($friend_id, 1);
24606 + // Check to see if there's a related local user
24607 + $flink = Foreign_link::getByForeignID($friend_id, 1);
24608 hunk ./lib/twitter.php 188
24611 hunk ./lib/twitter.php 190
24612 - // Get associated user and subscribe her
24613 - $friend_user = User::staticGet('id', $flink->user_id);
24614 - subs_subscribe_to($user, $friend_user);
24615 - common_debug("Twitter bridge - subscribed $friend_user->nickname to $user->nickname.");
24618 + // Get associated user and subscribe her
24619 + $friend_user = User::staticGet('id', $flink->user_id);
24620 + subs_subscribe_to($user, $friend_user);
24621 + common_debug("Twitter bridge - subscribed $friend_user->nickname to $user->nickname.");
24624 hunk ./lib/twitter.php 197
24627 hunk ./lib/twitterapi.php 24
24630 hunk ./lib/twitterapi.php 26
24631 - function handle($args) {
24632 - parent::handle($args);
24634 + function handle($args) {
24635 + parent::handle($args);
24637 hunk ./lib/twitterapi.php 30
24638 - function twitter_user_array($profile, $get_notice=false) {
24639 + function twitter_user_array($profile, $get_notice=false) {
24640 hunk ./lib/twitterapi.php 32
24641 - $twitter_user = array();
24642 + $twitter_user = array();
24643 hunk ./lib/twitterapi.php 34
24644 - $twitter_user['name'] = $profile->getBestName();
24645 - $twitter_user['followers_count'] = $this->count_subscriptions($profile);
24646 - $twitter_user['screen_name'] = $profile->nickname;
24647 - $twitter_user['description'] = ($profile->bio) ? $profile->bio : NULL;
24648 - $twitter_user['location'] = ($profile->location) ? $profile->location : NULL;
24649 - $twitter_user['id'] = intval($profile->id);
24650 + $twitter_user['name'] = $profile->getBestName();
24651 + $twitter_user['followers_count'] = $this->count_subscriptions($profile);
24652 + $twitter_user['screen_name'] = $profile->nickname;
24653 + $twitter_user['description'] = ($profile->bio) ? $profile->bio : NULL;
24654 + $twitter_user['location'] = ($profile->location) ? $profile->location : NULL;
24655 + $twitter_user['id'] = intval($profile->id);
24656 hunk ./lib/twitterapi.php 41
24657 - $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
24658 + $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
24659 hunk ./lib/twitterapi.php 43
24660 - $twitter_user['profile_image_url'] = ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE);
24661 - $twitter_user['protected'] = 'false'; # not supported by Laconica yet
24662 - $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : NULL;
24663 + $twitter_user['profile_image_url'] = ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE);
24664 + $twitter_user['protected'] = 'false'; # not supported by Laconica yet
24665 + $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : NULL;
24666 hunk ./lib/twitterapi.php 47
24667 - if ($get_notice) {
24668 - $notice = $profile->getCurrentNotice();
24670 - # don't get user!
24671 - $twitter_user['status'] = $this->twitter_status_array($notice, false);
24674 + if ($get_notice) {
24675 + $notice = $profile->getCurrentNotice();
24677 + # don't get user!
24678 + $twitter_user['status'] = $this->twitter_status_array($notice, false);
24681 hunk ./lib/twitterapi.php 55
24682 - return $twitter_user;
24684 + return $twitter_user;
24686 hunk ./lib/twitterapi.php 58
24687 - function twitter_status_array($notice, $include_user=true) {
24688 + function twitter_status_array($notice, $include_user=true) {
24689 hunk ./lib/twitterapi.php 60
24690 - $profile = $notice->getProfile();
24691 + $profile = $notice->getProfile();
24692 hunk ./lib/twitterapi.php 62
24693 - $twitter_status = array();
24694 - $twitter_status['text'] = $notice->content;
24695 - $twitter_status['truncated'] = 'false'; # Not possible on Laconica
24696 - $twitter_status['created_at'] = $this->date_twitter($notice->created);
24697 - $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
24698 - $twitter_status['source'] = $this->source_link($notice->source);
24699 - $twitter_status['id'] = intval($notice->id);
24700 - $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
24701 + $twitter_status = array();
24702 + $twitter_status['text'] = $notice->content;
24703 + $twitter_status['truncated'] = 'false'; # Not possible on Laconica
24704 + $twitter_status['created_at'] = $this->date_twitter($notice->created);
24705 + $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
24706 + $twitter_status['source'] = $this->source_link($notice->source);
24707 + $twitter_status['id'] = intval($notice->id);
24708 + $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
24709 hunk ./lib/twitterapi.php 71
24710 - if (isset($this->auth_user)) {
24711 - $twitter_status['favorited'] = ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
24713 - $twitter_status['favorited'] = 'false';
24715 + if (isset($this->auth_user)) {
24716 + $twitter_status['favorited'] = ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
24718 + $twitter_status['favorited'] = 'false';
24720 hunk ./lib/twitterapi.php 77
24721 - if ($include_user) {
24722 - # Don't get notice (recursive!)
24723 - $twitter_user = $this->twitter_user_array($profile, false);
24724 - $twitter_status['user'] = $twitter_user;
24726 + if ($include_user) {
24727 + # Don't get notice (recursive!)
24728 + $twitter_user = $this->twitter_user_array($profile, false);
24729 + $twitter_status['user'] = $twitter_user;
24731 hunk ./lib/twitterapi.php 83
24732 - return $twitter_status;
24734 + return $twitter_status;
24736 hunk ./lib/twitterapi.php 86
24737 - function twitter_rss_entry_array($notice) {
24738 + function twitter_rss_entry_array($notice) {
24739 hunk ./lib/twitterapi.php 88
24740 - $profile = $notice->getProfile();
24741 + $profile = $notice->getProfile();
24742 hunk ./lib/twitterapi.php 90
24743 - $server = common_config('site', 'server');
24744 - $entry = array();
24745 + $server = common_config('site', 'server');
24746 + $entry = array();
24747 hunk ./lib/twitterapi.php 95
24748 - $entry['content'] = common_xml_safe_str(trim($notice->rendered));
24749 - $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
24750 - $entry['link'] = common_local_url('shownotice', array('notice' => $notice->id));
24751 - $entry['published'] = common_date_iso8601($notice->created);
24752 - $entry['id'] = "tag:$server,2008:$entry[link]";
24753 - $entry['updated'] = $entry['published'];
24754 + $entry['content'] = common_xml_safe_str(trim($notice->rendered));
24755 + $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
24756 + $entry['link'] = common_local_url('shownotice', array('notice' => $notice->id));
24757 + $entry['published'] = common_date_iso8601($notice->created);
24758 + $entry['id'] = "tag:$server,2008:$entry[link]";
24759 + $entry['updated'] = $entry['published'];
24760 hunk ./lib/twitterapi.php 102
24761 - # RSS Item specific
24762 - $entry['description'] = $entry['content'];
24763 - $entry['pubDate'] = common_date_rfc2822($notice->created);
24764 - $entry['guid'] = $entry['link'];
24765 + # RSS Item specific
24766 + $entry['description'] = $entry['content'];
24767 + $entry['pubDate'] = common_date_rfc2822($notice->created);
24768 + $entry['guid'] = $entry['link'];
24769 hunk ./lib/twitterapi.php 107
24774 hunk ./lib/twitterapi.php 110
24775 - function twitter_rss_dmsg_array($message) {
24776 + function twitter_rss_dmsg_array($message) {
24777 hunk ./lib/twitterapi.php 112
24778 - $server = common_config('site', 'server');
24779 - $entry = array();
24780 + $server = common_config('site', 'server');
24781 + $entry = array();
24782 hunk ./lib/twitterapi.php 115
24783 - $entry['title'] = sprintf('Message from %s to %s',
24784 - $message->getFrom()->nickname, $message->getTo()->nickname);
24785 + $entry['title'] = sprintf('Message from %s to %s',
24786 + $message->getFrom()->nickname, $message->getTo()->nickname);
24787 hunk ./lib/twitterapi.php 118
24788 - $entry['content'] = common_xml_safe_str(trim($message->content));
24789 - $entry['link'] = common_local_url('showmessage', array('message' => $message->id));
24790 - $entry['published'] = common_date_iso8601($message->created);
24791 - $entry['id'] = "tag:$server,2008:$entry[link]";
24792 - $entry['updated'] = $entry['published'];
24793 + $entry['content'] = common_xml_safe_str(trim($message->content));
24794 + $entry['link'] = common_local_url('showmessage', array('message' => $message->id));
24795 + $entry['published'] = common_date_iso8601($message->created);
24796 + $entry['id'] = "tag:$server,2008:$entry[link]";
24797 + $entry['updated'] = $entry['published'];
24798 hunk ./lib/twitterapi.php 124
24799 - # RSS Item specific
24800 - $entry['description'] = $entry['content'];
24801 - $entry['pubDate'] = common_date_rfc2822($message->created);
24802 - $entry['guid'] = $entry['link'];
24803 + # RSS Item specific
24804 + $entry['description'] = $entry['content'];
24805 + $entry['pubDate'] = common_date_rfc2822($message->created);
24806 + $entry['guid'] = $entry['link'];
24807 hunk ./lib/twitterapi.php 129
24812 hunk ./lib/twitterapi.php 132
24813 - function twitter_dmsg_array($message) {
24814 + function twitter_dmsg_array($message) {
24815 hunk ./lib/twitterapi.php 134
24816 - $twitter_dm = array();
24817 + $twitter_dm = array();
24818 hunk ./lib/twitterapi.php 136
24819 - $from_profile = $message->getFrom();
24820 - $to_profile = $message->getTo();
24821 + $from_profile = $message->getFrom();
24822 + $to_profile = $message->getTo();
24823 hunk ./lib/twitterapi.php 139
24824 - $twitter_dm['id'] = $message->id;
24825 - $twitter_dm['sender_id'] = $message->from_profile;
24826 - $twitter_dm['text'] = trim($message->content);
24827 - $twitter_dm['recipient_id'] = $message->to_profile;
24828 - $twitter_dm['created_at'] = $this->date_twitter($message->created);
24829 - $twitter_dm['sender_screen_name'] = $from_profile->nickname;
24830 - $twitter_dm['recipient_screen_name'] = $to_profile->nickname;
24831 - $twitter_dm['sender'] = $this->twitter_user_array($from_profile, false);
24832 - $twitter_dm['recipient'] = $this->twitter_user_array($to_profile, false);
24833 + $twitter_dm['id'] = $message->id;
24834 + $twitter_dm['sender_id'] = $message->from_profile;
24835 + $twitter_dm['text'] = trim($message->content);
24836 + $twitter_dm['recipient_id'] = $message->to_profile;
24837 + $twitter_dm['created_at'] = $this->date_twitter($message->created);
24838 + $twitter_dm['sender_screen_name'] = $from_profile->nickname;
24839 + $twitter_dm['recipient_screen_name'] = $to_profile->nickname;
24840 + $twitter_dm['sender'] = $this->twitter_user_array($from_profile, false);
24841 + $twitter_dm['recipient'] = $this->twitter_user_array($to_profile, false);
24842 hunk ./lib/twitterapi.php 149
24843 - return $twitter_dm;
24845 + return $twitter_dm;
24847 hunk ./lib/twitterapi.php 152
24848 - function show_twitter_xml_status($twitter_status) {
24849 - common_element_start('status');
24850 - foreach($twitter_status as $element => $value) {
24851 - switch ($element) {
24853 - $this->show_twitter_xml_user($twitter_status['user']);
24856 - common_element($element, NULL, common_xml_safe_str($value));
24859 - common_element($element, NULL, $value);
24862 - common_element_end('status');
24864 + function show_twitter_xml_status($twitter_status) {
24865 + common_element_start('status');
24866 + foreach($twitter_status as $element => $value) {
24867 + switch ($element) {
24869 + $this->show_twitter_xml_user($twitter_status['user']);
24872 + common_element($element, NULL, common_xml_safe_str($value));
24875 + common_element($element, NULL, $value);
24878 + common_element_end('status');
24880 hunk ./lib/twitterapi.php 169
24881 - function show_twitter_xml_user($twitter_user, $role='user') {
24882 - common_element_start($role);
24883 - foreach($twitter_user as $element => $value) {
24884 - if ($element == 'status') {
24885 - $this->show_twitter_xml_status($twitter_user['status']);
24887 - common_element($element, NULL, $value);
24890 - common_element_end($role);
24892 + function show_twitter_xml_user($twitter_user, $role='user') {
24893 + common_element_start($role);
24894 + foreach($twitter_user as $element => $value) {
24895 + if ($element == 'status') {
24896 + $this->show_twitter_xml_status($twitter_user['status']);
24898 + common_element($element, NULL, $value);
24901 + common_element_end($role);
24903 hunk ./lib/twitterapi.php 181
24904 - function show_twitter_rss_item($entry) {
24905 - common_element_start('item');
24906 - common_element('title', NULL, $entry['title']);
24907 - common_element('description', NULL, $entry['description']);
24908 - common_element('pubDate', NULL, $entry['pubDate']);
24909 - common_element('guid', NULL, $entry['guid']);
24910 - common_element('link', NULL, $entry['link']);
24911 - common_element_end('item');
24913 + function show_twitter_rss_item($entry) {
24914 + common_element_start('item');
24915 + common_element('title', NULL, $entry['title']);
24916 + common_element('description', NULL, $entry['description']);
24917 + common_element('pubDate', NULL, $entry['pubDate']);
24918 + common_element('guid', NULL, $entry['guid']);
24919 + common_element('link', NULL, $entry['link']);
24920 + common_element_end('item');
24922 hunk ./lib/twitterapi.php 191
24923 - function show_twitter_atom_entry($entry) {
24924 - common_element_start('entry');
24925 - common_element('title', NULL, $entry['title']);
24926 - common_element('content', array('type' => 'html'), $entry['content']);
24927 - common_element('id', NULL, $entry['id']);
24928 - common_element('published', NULL, $entry['published']);
24929 - common_element('updated', NULL, $entry['updated']);
24930 - common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), NULL);
24931 - common_element_end('entry');
24933 + function show_twitter_atom_entry($entry) {
24934 + common_element_start('entry');
24935 + common_element('title', NULL, $entry['title']);
24936 + common_element('content', array('type' => 'html'), $entry['content']);
24937 + common_element('id', NULL, $entry['id']);
24938 + common_element('published', NULL, $entry['published']);
24939 + common_element('updated', NULL, $entry['updated']);
24940 + common_element('link', array('href' => $entry['link'], 'rel' => 'alternate', 'type' => 'text/html'), NULL);
24941 + common_element_end('entry');
24943 hunk ./lib/twitterapi.php 202
24944 - function show_json_objects($objects) {
24945 - print(json_encode($objects));
24947 + function show_json_objects($objects) {
24948 + print(json_encode($objects));
24950 hunk ./lib/twitterapi.php 206
24951 - function show_single_xml_status($notice) {
24952 - $this->init_document('xml');
24953 - $twitter_status = $this->twitter_status_array($notice);
24954 - $this->show_twitter_xml_status($twitter_status);
24955 - $this->end_document('xml');
24957 + function show_single_xml_status($notice) {
24958 + $this->init_document('xml');
24959 + $twitter_status = $this->twitter_status_array($notice);
24960 + $this->show_twitter_xml_status($twitter_status);
24961 + $this->end_document('xml');
24963 hunk ./lib/twitterapi.php 213
24964 - function show_single_json_status($notice) {
24965 - $this->init_document('json');
24966 - $status = $this->twitter_status_array($notice);
24967 - $this->show_json_objects($status);
24968 - $this->end_document('json');
24970 + function show_single_json_status($notice) {
24971 + $this->init_document('json');
24972 + $status = $this->twitter_status_array($notice);
24973 + $this->show_json_objects($status);
24974 + $this->end_document('json');
24976 hunk ./lib/twitterapi.php 220
24977 - function show_single_xml_dmsg($message) {
24978 - $this->init_document('xml');
24979 - $dmsg = $this->twitter_dmsg_array($message);
24980 - $this->show_twitter_xml_dmsg($dmsg);
24981 - $this->end_document('xml');
24983 + function show_single_xml_dmsg($message) {
24984 + $this->init_document('xml');
24985 + $dmsg = $this->twitter_dmsg_array($message);
24986 + $this->show_twitter_xml_dmsg($dmsg);
24987 + $this->end_document('xml');
24989 hunk ./lib/twitterapi.php 227
24990 - function show_single_json_dmsg($message) {
24991 - $this->init_document('json');
24992 - $dmsg = $this->twitter_dmsg_array($message);
24993 - $this->show_json_objects($dmsg);
24994 - $this->end_document('json');
24996 + function show_single_json_dmsg($message) {
24997 + $this->init_document('json');
24998 + $dmsg = $this->twitter_dmsg_array($message);
24999 + $this->show_json_objects($dmsg);
25000 + $this->end_document('json');
25002 hunk ./lib/twitterapi.php 234
25003 - function show_twitter_xml_dmsg($twitter_dm) {
25004 - common_element_start('direct_message');
25005 - foreach($twitter_dm as $element => $value) {
25006 - switch ($element) {
25008 - case 'recipient':
25009 - $this->show_twitter_xml_user($value, $element);
25012 - common_element($element, NULL, common_xml_safe_str($value));
25015 - common_element($element, NULL, $value);
25018 - common_element_end('direct_message');
25020 + function show_twitter_xml_dmsg($twitter_dm) {
25021 + common_element_start('direct_message');
25022 + foreach($twitter_dm as $element => $value) {
25023 + switch ($element) {
25025 + case 'recipient':
25026 + $this->show_twitter_xml_user($value, $element);
25029 + common_element($element, NULL, common_xml_safe_str($value));
25032 + common_element($element, NULL, $value);
25035 + common_element_end('direct_message');
25037 hunk ./lib/twitterapi.php 252
25038 - function show_xml_timeline($notice) {
25039 + function show_xml_timeline($notice) {
25040 hunk ./lib/twitterapi.php 254
25041 - $this->init_document('xml');
25042 - common_element_start('statuses', array('type' => 'array'));
25043 + $this->init_document('xml');
25044 + common_element_start('statuses', array('type' => 'array'));
25045 hunk ./lib/twitterapi.php 257
25046 - if (is_array($notice)) {
25047 - foreach ($notice as $n) {
25048 - $twitter_status = $this->twitter_status_array($n);
25049 - $this->show_twitter_xml_status($twitter_status);
25052 - while ($notice->fetch()) {
25053 - $twitter_status = $this->twitter_status_array($notice);
25054 - $this->show_twitter_xml_status($twitter_status);
25057 + if (is_array($notice)) {
25058 + foreach ($notice as $n) {
25059 + $twitter_status = $this->twitter_status_array($n);
25060 + $this->show_twitter_xml_status($twitter_status);
25063 + while ($notice->fetch()) {
25064 + $twitter_status = $this->twitter_status_array($notice);
25065 + $this->show_twitter_xml_status($twitter_status);
25068 hunk ./lib/twitterapi.php 269
25069 - common_element_end('statuses');
25070 - $this->end_document('xml');
25072 + common_element_end('statuses');
25073 + $this->end_document('xml');
25075 hunk ./lib/twitterapi.php 273
25076 - function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
25077 + function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
25078 hunk ./lib/twitterapi.php 275
25079 - $this->init_document('rss');
25080 + $this->init_document('rss');
25081 hunk ./lib/twitterapi.php 277
25082 - common_element_start('channel');
25083 - common_element('title', NULL, $title);
25084 - common_element('link', NULL, $link);
25085 - if (!is_null($suplink)) {
25086 - # For FriendFeed's SUP protocol
25087 - common_element('link', array('xmlns' => 'http://www.w3.org/2005/Atom',
25088 - 'rel' => 'http://api.friendfeed.com/2008/03#sup',
25089 - 'href' => $suplink,
25090 - 'type' => 'application/json'));
25092 - common_element('description', NULL, $subtitle);
25093 - common_element('language', NULL, 'en-us');
25094 - common_element('ttl', NULL, '40');
25095 + common_element_start('channel');
25096 + common_element('title', NULL, $title);
25097 + common_element('link', NULL, $link);
25098 + if (!is_null($suplink)) {
25099 + # For FriendFeed's SUP protocol
25100 + common_element('link', array('xmlns' => 'http://www.w3.org/2005/Atom',
25101 + 'rel' => 'http://api.friendfeed.com/2008/03#sup',
25102 + 'href' => $suplink,
25103 + 'type' => 'application/json'));
25105 + common_element('description', NULL, $subtitle);
25106 + common_element('language', NULL, 'en-us');
25107 + common_element('ttl', NULL, '40');
25108 hunk ./lib/twitterapi.php 291
25109 - if (is_array($notice)) {
25110 - foreach ($notice as $n) {
25111 - $entry = $this->twitter_rss_entry_array($n);
25112 - $this->show_twitter_rss_item($entry);
25115 - while ($notice->fetch()) {
25116 - $entry = $this->twitter_rss_entry_array($notice);
25117 - $this->show_twitter_rss_item($entry);
25120 + if (is_array($notice)) {
25121 + foreach ($notice as $n) {
25122 + $entry = $this->twitter_rss_entry_array($n);
25123 + $this->show_twitter_rss_item($entry);
25126 + while ($notice->fetch()) {
25127 + $entry = $this->twitter_rss_entry_array($notice);
25128 + $this->show_twitter_rss_item($entry);
25131 hunk ./lib/twitterapi.php 303
25132 - common_element_end('channel');
25133 - $this->end_twitter_rss();
25135 + common_element_end('channel');
25136 + $this->end_twitter_rss();
25138 hunk ./lib/twitterapi.php 307
25139 - function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
25140 + function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
25141 hunk ./lib/twitterapi.php 309
25142 - $this->init_document('atom');
25143 + $this->init_document('atom');
25144 hunk ./lib/twitterapi.php 311
25145 - common_element('title', NULL, $title);
25146 - common_element('id', NULL, $id);
25147 - common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
25148 - if (!is_null($suplink)) {
25149 - # For FriendFeed's SUP protocol
25150 - common_element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
25151 - 'href' => $suplink,
25152 - 'type' => 'application/json'));
25154 - common_element('subtitle', NULL, $subtitle);
25155 + common_element('title', NULL, $title);
25156 + common_element('id', NULL, $id);
25157 + common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
25158 + if (!is_null($suplink)) {
25159 + # For FriendFeed's SUP protocol
25160 + common_element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
25161 + 'href' => $suplink,
25162 + 'type' => 'application/json'));
25164 + common_element('subtitle', NULL, $subtitle);
25165 hunk ./lib/twitterapi.php 322
25166 - if (is_array($notice)) {
25167 - foreach ($notice as $n) {
25168 - $entry = $this->twitter_rss_entry_array($n);
25169 - $this->show_twitter_atom_entry($entry);
25172 - while ($notice->fetch()) {
25173 - $entry = $this->twitter_rss_entry_array($notice);
25174 - $this->show_twitter_atom_entry($entry);
25177 + if (is_array($notice)) {
25178 + foreach ($notice as $n) {
25179 + $entry = $this->twitter_rss_entry_array($n);
25180 + $this->show_twitter_atom_entry($entry);
25183 + while ($notice->fetch()) {
25184 + $entry = $this->twitter_rss_entry_array($notice);
25185 + $this->show_twitter_atom_entry($entry);
25188 hunk ./lib/twitterapi.php 334
25189 - $this->end_document('atom');
25190 + $this->end_document('atom');
25191 hunk ./lib/twitterapi.php 336
25194 hunk ./lib/twitterapi.php 338
25195 - function show_json_timeline($notice) {
25196 + function show_json_timeline($notice) {
25197 hunk ./lib/twitterapi.php 340
25198 - $this->init_document('json');
25199 + $this->init_document('json');
25200 hunk ./lib/twitterapi.php 342
25201 - $statuses = array();
25202 + $statuses = array();
25203 hunk ./lib/twitterapi.php 344
25204 - if (is_array($notice)) {
25205 - foreach ($notice as $n) {
25206 - $twitter_status = $this->twitter_status_array($n);
25207 - array_push($statuses, $twitter_status);
25210 - while ($notice->fetch()) {
25211 - $twitter_status = $this->twitter_status_array($notice);
25212 - array_push($statuses, $twitter_status);
25215 + if (is_array($notice)) {
25216 + foreach ($notice as $n) {
25217 + $twitter_status = $this->twitter_status_array($n);
25218 + array_push($statuses, $twitter_status);
25221 + while ($notice->fetch()) {
25222 + $twitter_status = $this->twitter_status_array($notice);
25223 + array_push($statuses, $twitter_status);
25226 hunk ./lib/twitterapi.php 356
25227 - $this->show_json_objects($statuses);
25228 + $this->show_json_objects($statuses);
25229 hunk ./lib/twitterapi.php 358
25230 - $this->end_document('json');
25232 + $this->end_document('json');
25234 hunk ./lib/twitterapi.php 361
25235 - // Anyone know what date format this is?
25236 - // Twitter's dates look like this: "Mon Jul 14 23:52:38 +0000 2008" -- Zach
25237 - function date_twitter($dt) {
25238 - $t = strtotime($dt);
25239 - return date("D M d G:i:s O Y", $t);
25241 + // Anyone know what date format this is?
25242 + // Twitter's dates look like this: "Mon Jul 14 23:52:38 +0000 2008" -- Zach
25243 + function date_twitter($dt) {
25244 + $t = strtotime($dt);
25245 + return date("D M d G:i:s O Y", $t);
25247 hunk ./lib/twitterapi.php 368
25248 - function replier_by_reply($reply_id) {
25249 - $notice = Notice::staticGet($reply_id);
25251 - $profile = $notice->getProfile();
25253 - return intval($profile->id);
25255 - common_debug('Can\'t find a profile for notice: ' . $notice->id, __FILE__);
25258 - common_debug("Can't get notice: $reply_id", __FILE__);
25262 + function replier_by_reply($reply_id) {
25263 + $notice = Notice::staticGet($reply_id);
25265 + $profile = $notice->getProfile();
25267 + return intval($profile->id);
25269 + common_debug('Can\'t find a profile for notice: ' . $notice->id, __FILE__);
25272 + common_debug("Can't get notice: $reply_id", __FILE__);
25276 hunk ./lib/twitterapi.php 383
25277 - // XXX: Candidate for a general utility method somewhere?
25278 - function count_subscriptions($profile) {
25279 + // XXX: Candidate for a general utility method somewhere?
25280 + function count_subscriptions($profile) {
25281 hunk ./lib/twitterapi.php 386
25283 - $sub = new Subscription();
25284 - $sub->subscribed = $profile->id;
25286 + $sub = new Subscription();
25287 + $sub->subscribed = $profile->id;
25288 hunk ./lib/twitterapi.php 390
25289 - $count = $sub->find();
25290 + $count = $sub->find();
25291 hunk ./lib/twitterapi.php 392
25292 - if ($count > 0) {
25293 - return $count - 1;
25298 + if ($count > 0) {
25299 + return $count - 1;
25304 hunk ./lib/twitterapi.php 399
25305 - function init_document($type='xml') {
25308 - header('Content-Type: application/xml; charset=utf-8');
25309 - common_start_xml();
25312 - header('Content-Type: application/json; charset=utf-8');
25313 + function init_document($type='xml') {
25316 + header('Content-Type: application/xml; charset=utf-8');
25317 + common_start_xml();
25320 + header('Content-Type: application/json; charset=utf-8');
25321 hunk ./lib/twitterapi.php 408
25322 - // Check for JSONP callback
25323 - $callback = $this->arg('callback');
25325 - print $callback . '(';
25329 - header("Content-Type: application/rss+xml; charset=utf-8");
25330 - $this->init_twitter_rss();
25333 - header('Content-Type: application/atom+xml; charset=utf-8');
25334 - $this->init_twitter_atom();
25337 - $this->client_error(_('Not a supported data format.'));
25340 + // Check for JSONP callback
25341 + $callback = $this->arg('callback');
25343 + print $callback . '(';
25347 + header("Content-Type: application/rss+xml; charset=utf-8");
25348 + $this->init_twitter_rss();
25351 + header('Content-Type: application/atom+xml; charset=utf-8');
25352 + $this->init_twitter_atom();
25355 + $this->client_error(_('Not a supported data format.'));
25358 hunk ./lib/twitterapi.php 427
25363 hunk ./lib/twitterapi.php 430
25364 - function end_document($type='xml') {
25367 - common_end_xml();
25370 + function end_document($type='xml') {
25373 + common_end_xml();
25376 hunk ./lib/twitterapi.php 437
25377 - // Check for JSONP callback
25378 - $callback = $this->arg('callback');
25384 - $this->end_twitter_rss();
25387 - $this->end_twitter_rss();
25390 - $this->client_error(_('Not a supported data format.'));
25395 + // Check for JSONP callback
25396 + $callback = $this->arg('callback');
25402 + $this->end_twitter_rss();
25405 + $this->end_twitter_rss();
25408 + $this->client_error(_('Not a supported data format.'));
25413 hunk ./lib/twitterapi.php 456
25414 - function client_error($msg, $code = 400, $content_type = 'json') {
25415 + function client_error($msg, $code = 400, $content_type = 'json') {
25416 hunk ./lib/twitterapi.php 458
25417 - static $status = array(400 => 'Bad Request',
25418 - 401 => 'Unauthorized',
25419 - 402 => 'Payment Required',
25420 - 403 => 'Forbidden',
25421 - 404 => 'Not Found',
25422 - 405 => 'Method Not Allowed',
25423 - 406 => 'Not Acceptable',
25424 - 407 => 'Proxy Authentication Required',
25425 - 408 => 'Request Timeout',
25426 - 409 => 'Conflict',
25428 - 411 => 'Length Required',
25429 - 412 => 'Precondition Failed',
25430 - 413 => 'Request Entity Too Large',
25431 - 414 => 'Request-URI Too Long',
25432 - 415 => 'Unsupported Media Type',
25433 - 416 => 'Requested Range Not Satisfiable',
25434 - 417 => 'Expectation Failed');
25435 + static $status = array(400 => 'Bad Request',
25436 + 401 => 'Unauthorized',
25437 + 402 => 'Payment Required',
25438 + 403 => 'Forbidden',
25439 + 404 => 'Not Found',
25440 + 405 => 'Method Not Allowed',
25441 + 406 => 'Not Acceptable',
25442 + 407 => 'Proxy Authentication Required',
25443 + 408 => 'Request Timeout',
25444 + 409 => 'Conflict',
25446 + 411 => 'Length Required',
25447 + 412 => 'Precondition Failed',
25448 + 413 => 'Request Entity Too Large',
25449 + 414 => 'Request-URI Too Long',
25450 + 415 => 'Unsupported Media Type',
25451 + 416 => 'Requested Range Not Satisfiable',
25452 + 417 => 'Expectation Failed');
25453 hunk ./lib/twitterapi.php 477
25454 - $action = $this->trimmed('action');
25455 + $action = $this->trimmed('action');
25456 hunk ./lib/twitterapi.php 479
25457 - common_debug("User error '$code' on '$action': $msg", __FILE__);
25458 + common_debug("User error '$code' on '$action': $msg", __FILE__);
25459 hunk ./lib/twitterapi.php 481
25460 - if (!array_key_exists($code, $status)) {
25463 + if (!array_key_exists($code, $status)) {
25466 hunk ./lib/twitterapi.php 485
25467 - $status_string = $status[$code];
25468 - header('HTTP/1.1 '.$code.' '.$status_string);
25469 + $status_string = $status[$code];
25470 + header('HTTP/1.1 '.$code.' '.$status_string);
25471 hunk ./lib/twitterapi.php 488
25472 - if ($content_type == 'xml') {
25473 - $this->init_document('xml');
25474 - common_element_start('hash');
25475 - common_element('error', NULL, $msg);
25476 - common_element('request', NULL, $_SERVER['REQUEST_URI']);
25477 - common_element_end('hash');
25478 - $this->end_document('xml');
25480 - $this->init_document('json');
25481 - $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
25482 - print(json_encode($error_array));
25483 - $this->end_document('json');
25485 + if ($content_type == 'xml') {
25486 + $this->init_document('xml');
25487 + common_element_start('hash');
25488 + common_element('error', NULL, $msg);
25489 + common_element('request', NULL, $_SERVER['REQUEST_URI']);
25490 + common_element_end('hash');
25491 + $this->end_document('xml');
25493 + $this->init_document('json');
25494 + $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
25495 + print(json_encode($error_array));
25496 + $this->end_document('json');
25498 hunk ./lib/twitterapi.php 502
25501 hunk ./lib/twitterapi.php 504
25502 - function init_twitter_rss() {
25503 - common_start_xml();
25504 - common_element_start('rss', array('version' => '2.0'));
25506 + function init_twitter_rss() {
25507 + common_start_xml();
25508 + common_element_start('rss', array('version' => '2.0'));
25510 hunk ./lib/twitterapi.php 509
25511 - function end_twitter_rss() {
25512 - common_element_end('rss');
25513 - common_end_xml();
25515 + function end_twitter_rss() {
25516 + common_element_end('rss');
25517 + common_end_xml();
25519 hunk ./lib/twitterapi.php 514
25520 - function init_twitter_atom() {
25521 - common_start_xml();
25522 - common_element_start('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US'));
25524 + function init_twitter_atom() {
25525 + common_start_xml();
25526 + common_element_start('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US'));
25528 hunk ./lib/twitterapi.php 519
25529 - function end_twitter_atom() {
25530 - common_end_xml();
25531 - common_element_end('feed');
25533 + function end_twitter_atom() {
25534 + common_end_xml();
25535 + common_element_end('feed');
25537 hunk ./lib/twitterapi.php 524
25538 - function show_profile($profile, $content_type='xml', $notice=NULL) {
25539 - $profile_array = $this->twitter_user_array($profile, true);
25540 - switch ($content_type) {
25542 - $this->show_twitter_xml_user($profile_array);
25545 - $this->show_json_objects($profile_array);
25548 - $this->client_error(_('Not a supported data format.'));
25553 + function show_profile($profile, $content_type='xml', $notice=NULL) {
25554 + $profile_array = $this->twitter_user_array($profile, true);
25555 + switch ($content_type) {
25557 + $this->show_twitter_xml_user($profile_array);
25560 + $this->show_json_objects($profile_array);
25563 + $this->client_error(_('Not a supported data format.'));
25568 hunk ./lib/twitterapi.php 540
25569 - function get_user($id, $apidata=NULL) {
25571 - return $apidata['user'];
25572 - } else if (is_numeric($id)) {
25573 - return User::staticGet($id);
25575 - $nickname = common_canonical_nickname($id);
25576 - return User::staticGet('nickname', $nickname);
25579 + function get_user($id, $apidata=NULL) {
25581 + return $apidata['user'];
25582 + } else if (is_numeric($id)) {
25583 + return User::staticGet($id);
25585 + $nickname = common_canonical_nickname($id);
25586 + return User::staticGet('nickname', $nickname);
25589 hunk ./lib/twitterapi.php 551
25590 - function get_profile($id) {
25591 - if (is_numeric($id)) {
25592 - return Profile::staticGet($id);
25594 - $user = User::staticGet('nickname', $id);
25596 - return $user->getProfile();
25602 + function get_profile($id) {
25603 + if (is_numeric($id)) {
25604 + return Profile::staticGet($id);
25606 + $user = User::staticGet('nickname', $id);
25608 + return $user->getProfile();
25614 hunk ./lib/twitterapi.php 564
25615 - function source_link($source) {
25616 - $source_name = _($source);
25617 - switch ($source) {
25625 - $ns = Notice_source::staticGet($source);
25627 - $source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>';
25631 - return $source_name;
25633 + function source_link($source) {
25634 + $source_name = _($source);
25635 + switch ($source) {
25643 + $ns = Notice_source::staticGet($source);
25645 + $source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>';
25649 + return $source_name;
25651 hunk ./lib/twitterapi.php 583
25652 - function show_extended_profile($user, $apidata) {
25653 + function show_extended_profile($user, $apidata) {
25654 hunk ./lib/twitterapi.php 585
25655 - $this->auth_user = $apidata['user'];
25656 + $this->auth_user = $apidata['user'];
25657 hunk ./lib/twitterapi.php 587
25658 - $profile = $user->getProfile();
25659 + $profile = $user->getProfile();
25660 hunk ./lib/twitterapi.php 589
25662 - common_server_error(_('User has no profile.'));
25666 + common_server_error(_('User has no profile.'));
25669 hunk ./lib/twitterapi.php 594
25670 - $twitter_user = $this->twitter_user_array($profile, true);
25671 + $twitter_user = $this->twitter_user_array($profile, true);
25672 hunk ./lib/twitterapi.php 596
25673 - // Add in extended user fields offered up by this method
25674 - $twitter_user['created_at'] = $this->date_twitter($profile->created);
25675 + // Add in extended user fields offered up by this method
25676 + $twitter_user['created_at'] = $this->date_twitter($profile->created);
25677 hunk ./lib/twitterapi.php 599
25678 - $subbed = DB_DataObject::factory('subscription');
25679 - $subbed->subscriber = $profile->id;
25680 - $subbed_count = (int) $subbed->count() - 1;
25681 + $subbed = DB_DataObject::factory('subscription');
25682 + $subbed->subscriber = $profile->id;
25683 + $subbed_count = (int) $subbed->count() - 1;
25684 hunk ./lib/twitterapi.php 603
25685 - $notices = DB_DataObject::factory('notice');
25686 - $notices->profile_id = $profile->id;
25687 - $notice_count = (int) $notices->count();
25688 + $notices = DB_DataObject::factory('notice');
25689 + $notices->profile_id = $profile->id;
25690 + $notice_count = (int) $notices->count();
25691 hunk ./lib/twitterapi.php 607
25692 - $twitter_user['friends_count'] = (is_int($subbed_count)) ? $subbed_count : 0;
25693 - $twitter_user['statuses_count'] = (is_int($notice_count)) ? $notice_count : 0;
25694 + $twitter_user['friends_count'] = (is_int($subbed_count)) ? $subbed_count : 0;
25695 + $twitter_user['statuses_count'] = (is_int($notice_count)) ? $notice_count : 0;
25696 hunk ./lib/twitterapi.php 610
25697 - // Other fields Twitter sends...
25698 - $twitter_user['profile_background_color'] = '';
25699 - $twitter_user['profile_text_color'] = '';
25700 - $twitter_user['profile_link_color'] = '';
25701 - $twitter_user['profile_sidebar_fill_color'] = '';
25702 + // Other fields Twitter sends...
25703 + $twitter_user['profile_background_color'] = '';
25704 + $twitter_user['profile_text_color'] = '';
25705 + $twitter_user['profile_link_color'] = '';
25706 + $twitter_user['profile_sidebar_fill_color'] = '';
25707 hunk ./lib/twitterapi.php 616
25708 - $faves = DB_DataObject::factory('fave');
25709 - $faves->user_id = $user->id;
25710 - $faves_count = (int) $faves->count();
25711 - $twitter_user['favourites_count'] = $faves_count;
25712 + $faves = DB_DataObject::factory('fave');
25713 + $faves->user_id = $user->id;
25714 + $faves_count = (int) $faves->count();
25715 + $twitter_user['favourites_count'] = $faves_count;
25716 hunk ./lib/twitterapi.php 621
25717 - $timezone = 'UTC';
25718 + $timezone = 'UTC';
25719 hunk ./lib/twitterapi.php 623
25720 - if ($user->timezone) {
25721 - $timezone = $user->timezone;
25723 + if ($user->timezone) {
25724 + $timezone = $user->timezone;
25726 hunk ./lib/twitterapi.php 627
25727 - $t = new DateTime;
25728 - $t->setTimezone(new DateTimeZone($timezone));
25729 - $twitter_user['utc_offset'] = $t->format('Z');
25730 - $twitter_user['time_zone'] = $timezone;
25731 + $t = new DateTime;
25732 + $t->setTimezone(new DateTimeZone($timezone));
25733 + $twitter_user['utc_offset'] = $t->format('Z');
25734 + $twitter_user['time_zone'] = $timezone;
25735 hunk ./lib/twitterapi.php 632
25736 - $following = 'false';
25737 + $following = 'false';
25738 hunk ./lib/twitterapi.php 634
25739 - if (isset($this->auth_user)) {
25740 - if ($this->auth_user->isSubscribed($profile)) {
25741 - $following = 'true';
25743 + if (isset($this->auth_user)) {
25744 + if ($this->auth_user->isSubscribed($profile)) {
25745 + $following = 'true';
25747 hunk ./lib/twitterapi.php 639
25748 - // Not implemented yet
25749 - $twitter_user['notifications'] = 'false';
25751 + // Not implemented yet
25752 + $twitter_user['notifications'] = 'false';
25754 hunk ./lib/twitterapi.php 643
25755 - $twitter_user['following'] = $following;
25756 + $twitter_user['following'] = $following;
25757 hunk ./lib/twitterapi.php 645
25758 - if ($apidata['content-type'] == 'xml') {
25759 - $this->init_document('xml');
25760 - $this->show_twitter_xml_user($twitter_user);
25761 - $this->end_document('xml');
25762 - } elseif ($apidata['content-type'] == 'json') {
25763 - $this->init_document('json');
25764 - $this->show_json_objects($twitter_user);
25765 - $this->end_document('json');
25767 + if ($apidata['content-type'] == 'xml') {
25768 + $this->init_document('xml');
25769 + $this->show_twitter_xml_user($twitter_user);
25770 + $this->end_document('xml');
25771 + } elseif ($apidata['content-type'] == 'json') {
25772 + $this->init_document('json');
25773 + $this->show_json_objects($twitter_user);
25774 + $this->end_document('json');
25776 hunk ./lib/twitterapi.php 655
25779 hunk ./lib/xmppqueuehandler.php 32
25781 - function start() {
25782 - # Low priority; we don't want to receive messages
25783 - $this->log(LOG_INFO, "INITIALIZE");
25784 - $this->conn = jabber_connect($this->_id);
25785 - if ($this->conn) {
25786 - $this->conn->addEventHandler('message', 'forward_message', $this);
25787 - $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
25788 - $this->conn->setReconnectTimeout(600);
25789 - jabber_send_presence("Send me a message to post a notice", 'available', NULL, 'available', -1);
25791 - return !is_null($this->conn);
25794 - function handle_reconnect(&$pl) {
25795 - $this->conn->processUntil('session_start');
25796 - $this->conn->presence(NULL, 'available', NULL, 'available', -1);
25799 + function start() {
25800 + # Low priority; we don't want to receive messages
25801 + $this->log(LOG_INFO, "INITIALIZE");
25802 + $this->conn = jabber_connect($this->_id);
25803 + if ($this->conn) {
25804 + $this->conn->addEventHandler('message', 'forward_message', $this);
25805 + $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
25806 + $this->conn->setReconnectTimeout(600);
25807 + jabber_send_presence("Send me a message to post a notice", 'available', NULL, 'available', -1);
25809 + return !is_null($this->conn);
25812 + function handle_reconnect(&$pl) {
25813 + $this->conn->processUntil('session_start');
25814 + $this->conn->presence(NULL, 'available', NULL, 'available', -1);
25816 hunk ./lib/xmppqueuehandler.php 51
25817 - function idle($timeout=0) {
25818 - # Process the queue for as long as needed
25820 - if ($this->conn) {
25821 - $this->conn->processTime($timeout);
25823 - } catch (XMPPHP_Exception $e) {
25824 - $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
25825 - die($e->getMessage());
25829 - function forward_message(&$pl) {
25830 - if ($pl['type'] != 'chat') {
25831 - $this->log(LOG_DEBUG, 'Ignoring message of type ' . $pl['type'] . ' from ' . $pl['from']);
25834 - $listener = $this->listener();
25835 - if (strtolower($listener) == strtolower($pl['from'])) {
25836 - $this->log(LOG_WARNING, 'Ignoring loop message.');
25839 - $this->log(LOG_INFO, 'Forwarding message from ' . $pl['from'] . ' to ' . $listener);
25840 - $this->conn->message($this->listener(), $pl['body'], 'chat', NULL, $this->ofrom($pl['from']));
25842 + function idle($timeout=0) {
25843 + # Process the queue for as long as needed
25845 + if ($this->conn) {
25846 + $this->conn->processTime($timeout);
25848 + } catch (XMPPHP_Exception $e) {
25849 + $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
25850 + die($e->getMessage());
25854 + function forward_message(&$pl) {
25855 + if ($pl['type'] != 'chat') {
25856 + $this->log(LOG_DEBUG, 'Ignoring message of type ' . $pl['type'] . ' from ' . $pl['from']);
25859 + $listener = $this->listener();
25860 + if (strtolower($listener) == strtolower($pl['from'])) {
25861 + $this->log(LOG_WARNING, 'Ignoring loop message.');
25864 + $this->log(LOG_INFO, 'Forwarding message from ' . $pl['from'] . ' to ' . $listener);
25865 + $this->conn->message($this->listener(), $pl['body'], 'chat', NULL, $this->ofrom($pl['from']));
25867 hunk ./lib/xmppqueuehandler.php 77
25868 - function ofrom($from) {
25869 - $address = "<addresses xmlns='http://jabber.org/protocol/address'>\n";
25870 - $address .= "<address type='ofrom' jid='$from' />\n";
25871 - $address .= "</addresses>\n";
25874 + function ofrom($from) {
25875 + $address = "<addresses xmlns='http://jabber.org/protocol/address'>\n";
25876 + $address .= "<address type='ofrom' jid='$from' />\n";
25877 + $address .= "</addresses>\n";
25880 hunk ./lib/xmppqueuehandler.php 84
25881 - function listener() {
25882 - if (common_config('xmpp', 'listener')) {
25883 - return common_config('xmpp', 'listener');
25885 - return jabber_daemon_address() . '/' . common_config('xmpp','resource') . '-listener';
25888 + function listener() {
25889 + if (common_config('xmpp', 'listener')) {
25890 + return common_config('xmpp', 'listener');
25892 + return jabber_daemon_address() . '/' . common_config('xmpp','resource') . '-listener';
25895 hunk ./scripts/enjitqueuehandler.php 23
25896 - print "This script must be run from the command line\n";
25898 + print "This script must be run from the command line\n";
25900 hunk ./scripts/enjitqueuehandler.php 37
25902 - function transport() {
25906 + function transport() {
25909 hunk ./scripts/enjitqueuehandler.php 42
25910 - function start() {
25911 + function start() {
25912 hunk ./scripts/enjitqueuehandler.php 45
25917 hunk ./scripts/enjitqueuehandler.php 48
25918 - function handle_notice($notice) {
25919 + function handle_notice($notice) {
25920 hunk ./scripts/enjitqueuehandler.php 50
25921 - $profile = Profile::staticGet($notice->profile_id);
25922 + $profile = Profile::staticGet($notice->profile_id);
25923 hunk ./scripts/enjitqueuehandler.php 63
25924 - $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
25925 - $msg = $profile->nickname . ': ' . $notice->content;
25926 + $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
25927 + $msg = $profile->nickname . ': ' . $notice->content;
25928 hunk ./scripts/enjitqueuehandler.php 66
25929 - $atom = "<entry xmlns='http://www.w3.org/2005/Atom'>\n";
25930 - $atom .= "<apisource>".common_config('enjit','source')."</apisource>\n";
25931 - $atom .= "<source>\n";
25932 - $atom .= "<title>" . $profile->nickname . " - " . common_config('site', 'name') . "</title>\n";
25933 - $atom .= "<link href='" . $profile->profileurl . "'/>\n";
25934 - $atom .= "<link rel='self' type='application/rss+xml' href='" . common_local_url('userrss', array('nickname' => $profile->nickname)) . "'/>\n";
25935 - $atom .= "<author><name>" . $profile->nickname . "</name></author>\n";
25936 - $atom .= "<icon>" . common_profile_avatar_url($profile, AVATAR_PROFILE_SIZE) . "</icon>\n";
25937 - $atom .= "</source>\n";
25938 - $atom .= "<title>" . htmlspecialchars($msg) . "</title>\n";
25939 - $atom .= "<summary>" . htmlspecialchars($msg) . "</summary>\n";
25940 - $atom .= "<link rel='alternate' href='" . $noticeurl . "' />\n";
25941 - $atom .= "<id>". $notice->uri . "</id>\n";
25942 - $atom .= "<published>".common_date_w3dtf($notice->created)."</published>\n";
25943 - $atom .= "<updated>".common_date_w3dtf($notice->modified)."</updated>\n";
25944 - $atom .= "</entry>\n";
25945 + $atom = "<entry xmlns='http://www.w3.org/2005/Atom'>\n";
25946 + $atom .= "<apisource>".common_config('enjit','source')."</apisource>\n";
25947 + $atom .= "<source>\n";
25948 + $atom .= "<title>" . $profile->nickname . " - " . common_config('site', 'name') . "</title>\n";
25949 + $atom .= "<link href='" . $profile->profileurl . "'/>\n";
25950 + $atom .= "<link rel='self' type='application/rss+xml' href='" . common_local_url('userrss', array('nickname' => $profile->nickname)) . "'/>\n";
25951 + $atom .= "<author><name>" . $profile->nickname . "</name></author>\n";
25952 + $atom .= "<icon>" . common_profile_avatar_url($profile, AVATAR_PROFILE_SIZE) . "</icon>\n";
25953 + $atom .= "</source>\n";
25954 + $atom .= "<title>" . htmlspecialchars($msg) . "</title>\n";
25955 + $atom .= "<summary>" . htmlspecialchars($msg) . "</summary>\n";
25956 + $atom .= "<link rel='alternate' href='" . $noticeurl . "' />\n";
25957 + $atom .= "<id>". $notice->uri . "</id>\n";
25958 + $atom .= "<published>".common_date_w3dtf($notice->created)."</published>\n";
25959 + $atom .= "<updated>".common_date_w3dtf($notice->modified)."</updated>\n";
25960 + $atom .= "</entry>\n";
25961 hunk ./scripts/enjitqueuehandler.php 89
25962 - $ch = curl_init();
25963 + $ch = curl_init();
25964 hunk ./scripts/enjitqueuehandler.php 91
25965 - curl_setopt($ch, CURLOPT_URL, $url);
25966 + curl_setopt($ch, CURLOPT_URL, $url);
25967 hunk ./scripts/enjitqueuehandler.php 94
25968 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
25969 - curl_setopt($ch, CURLOPT_POST, 1) ;
25970 - curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
25971 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
25972 + curl_setopt($ch, CURLOPT_POST, 1) ;
25973 + curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
25974 hunk ./scripts/enjitqueuehandler.php 100
25975 - # curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
25976 - # curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
25977 + # curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
25978 + # curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
25979 hunk ./scripts/enjitqueuehandler.php 104
25980 - $result = curl_exec($ch);
25981 + $result = curl_exec($ch);
25982 hunk ./scripts/enjitqueuehandler.php 106
25983 - $code = curl_getinfo($ch, CURLINFO_HTTP_CODE );
25984 + $code = curl_getinfo($ch, CURLINFO_HTTP_CODE );
25985 hunk ./scripts/enjitqueuehandler.php 110
25988 hunk ./scripts/enjitqueuehandler.php 113
25993 hunk ./scripts/enjitqueuehandler.php 125
25994 - $handler->handle_queue();
25995 + $handler->handle_queue();
25996 hunk ./scripts/fixup_hashtags.php 40
25997 - $original = clone($notice);
25998 - $notice->rendered = common_render_content($notice->content, $notice);
25999 - $result = $notice->update($original);
26001 - common_log_db_error($notice, 'UPDATE', __FILE__);
26003 + $original = clone($notice);
26004 + $notice->rendered = common_render_content($notice->content, $notice);
26005 + $result = $notice->update($original);
26007 + common_log_db_error($notice, 'UPDATE', __FILE__);
26009 hunk ./scripts/fixup_inboxes.php 44
26010 - $user->whereAdd('id >= ' . $start_at);
26011 + $user->whereAdd('id >= ' . $start_at);
26012 hunk ./scripts/fixup_inboxes.php 52
26013 - $user->query('BEGIN');
26014 - $inbox = new Notice_inbox();
26015 - $result = $inbox->query('INSERT LOW_PRIORITY INTO notice_inbox (user_id, notice_id, created) ' .
26016 - 'SELECT ' . $user->id . ', notice.id, notice.created ' .
26017 - 'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
26018 - 'WHERE subscription.subscriber = ' . $user->id . ' ' .
26019 - 'AND notice.created >= subscription.created ' .
26020 - 'AND NOT EXISTS (SELECT user_id, notice_id ' .
26021 - 'FROM notice_inbox ' .
26022 - 'WHERE user_id = ' . $user->id . ' ' .
26023 - 'AND notice_id = notice.id)');
26024 - if (is_null($result) || $result === false) {
26025 - common_log_db_error($inbox, 'INSERT', __FILE__);
26028 - $orig = clone($user);
26029 - $user->inboxed = 1;
26030 - $result = $user->update($orig);
26032 - common_log_db_error($user, 'UPDATE', __FILE__);
26035 - $user->query('COMMIT');
26039 - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
26041 + $user->query('BEGIN');
26042 + $inbox = new Notice_inbox();
26043 + $result = $inbox->query('INSERT LOW_PRIORITY INTO notice_inbox (user_id, notice_id, created) ' .
26044 + 'SELECT ' . $user->id . ', notice.id, notice.created ' .
26045 + 'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
26046 + 'WHERE subscription.subscriber = ' . $user->id . ' ' .
26047 + 'AND notice.created >= subscription.created ' .
26048 + 'AND NOT EXISTS (SELECT user_id, notice_id ' .
26049 + 'FROM notice_inbox ' .
26050 + 'WHERE user_id = ' . $user->id . ' ' .
26051 + 'AND notice_id = notice.id)');
26052 + if (is_null($result) || $result === false) {
26053 + common_log_db_error($inbox, 'INSERT', __FILE__);
26056 + $orig = clone($user);
26057 + $user->inboxed = 1;
26058 + $result = $user->update($orig);
26060 + common_log_db_error($user, 'UPDATE', __FILE__);
26063 + $user->query('COMMIT');
26067 + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
26069 hunk ./scripts/fixup_notices_rendered.php 23
26070 - print "This script must be run from the command line\n";
26072 + print "This script must be run from the command line\n";
26074 hunk ./scripts/fixup_notices_rendered.php 38
26075 - $notice->whereAdd('id >= ' . $start_at);
26076 + $notice->whereAdd('id >= ' . $start_at);
26077 hunk ./scripts/fixup_notices_rendered.php 43
26078 - common_log(LOG_INFO, 'Pre-rendering notice #' . $notice->id);
26079 - $original = clone($notice);
26080 - $notice->rendered = common_render_content($notice->content, $notice);
26081 - $result = $notice->update($original);
26083 - common_log_db_error($notice, 'UPDATE', __FILE__);
26085 + common_log(LOG_INFO, 'Pre-rendering notice #' . $notice->id);
26086 + $original = clone($notice);
26087 + $notice->rendered = common_render_content($notice->content, $notice);
26088 + $result = $notice->update($original);
26090 + common_log_db_error($notice, 'UPDATE', __FILE__);
26092 hunk ./scripts/getpiddir.php 23
26093 - print "This script must be run from the command line\n";
26095 + print "This script must be run from the command line\n";
26097 hunk ./scripts/inbox_users.php 45
26099 - $user = User::staticGet('id', $id);
26101 + $user = User::staticGet('id', $id);
26102 hunk ./scripts/inbox_users.php 48
26104 - common_log(LOG_WARNING, 'No such user: ' . $id);
26108 - if ($user->inboxed) {
26109 - common_log(LOG_WARNING, 'Already inboxed: ' . $id);
26114 + common_log(LOG_WARNING, 'No such user: ' . $id);
26118 + if ($user->inboxed) {
26119 + common_log(LOG_WARNING, 'Already inboxed: ' . $id);
26123 hunk ./scripts/inbox_users.php 59
26125 - $user->query('BEGIN');
26127 - $old_inbox = new Notice_inbox();
26128 - $old_inbox->user_id = $user->id;
26130 - $result = $old_inbox->delete();
26132 - if (is_null($result) || $result === false) {
26133 - common_log_db_error($old_inbox, 'DELETE', __FILE__);
26137 + $user->query('BEGIN');
26139 + $old_inbox = new Notice_inbox();
26140 + $old_inbox->user_id = $user->id;
26142 + $result = $old_inbox->delete();
26144 + if (is_null($result) || $result === false) {
26145 + common_log_db_error($old_inbox, 'DELETE', __FILE__);
26148 hunk ./scripts/inbox_users.php 72
26149 - $old_inbox->free();
26151 - $inbox = new Notice_inbox();
26153 - $result = $inbox->query('INSERT INTO notice_inbox (user_id, notice_id, created) ' .
26154 - 'SELECT ' . $user->id . ', notice.id, notice.created ' .
26155 - 'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
26156 - 'WHERE subscription.subscriber = ' . $user->id . ' ' .
26157 - 'AND notice.created >= subscription.created ' .
26158 - 'AND now() - notice.created < ' . (7 * 24 * 3600) . ' ' .
26159 - 'AND NOT EXISTS (SELECT user_id, notice_id ' .
26160 - 'FROM notice_inbox ' .
26161 - 'WHERE user_id = ' . $user->id . ' ' .
26162 - 'AND notice_id = notice.id)');
26164 - if (is_null($result) || $result === false) {
26165 - common_log_db_error($inbox, 'INSERT', __FILE__);
26169 - $orig = clone($user);
26170 - $user->inboxed = 1;
26171 - $result = $user->update($orig);
26174 - common_log_db_error($user, 'UPDATE', __FILE__);
26178 - $user->query('COMMIT');
26184 - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
26186 + $old_inbox->free();
26188 + $inbox = new Notice_inbox();
26190 + $result = $inbox->query('INSERT INTO notice_inbox (user_id, notice_id, created) ' .
26191 + 'SELECT ' . $user->id . ', notice.id, notice.created ' .
26192 + 'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
26193 + 'WHERE subscription.subscriber = ' . $user->id . ' ' .
26194 + 'AND notice.created >= subscription.created ' .
26195 + 'AND now() - notice.created < ' . (7 * 24 * 3600) . ' ' .
26196 + 'AND NOT EXISTS (SELECT user_id, notice_id ' .
26197 + 'FROM notice_inbox ' .
26198 + 'WHERE user_id = ' . $user->id . ' ' .
26199 + 'AND notice_id = notice.id)');
26201 + if (is_null($result) || $result === false) {
26202 + common_log_db_error($inbox, 'INSERT', __FILE__);
26206 + $orig = clone($user);
26207 + $user->inboxed = 1;
26208 + $result = $user->update($orig);
26211 + common_log_db_error($user, 'UPDATE', __FILE__);
26215 + $user->query('COMMIT');
26221 + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
26223 hunk ./scripts/jabberqueuehandler.php 23
26224 - print "This script must be run from the command line\n";
26226 + print "This script must be run from the command line\n";
26228 hunk ./scripts/jabberqueuehandler.php 38
26229 - var $conn = NULL;
26230 + var $conn = NULL;
26231 hunk ./scripts/jabberqueuehandler.php 40
26232 - function transport() {
26235 + function transport() {
26238 hunk ./scripts/jabberqueuehandler.php 44
26239 - function handle_notice($notice) {
26241 - return jabber_broadcast_notice($notice);
26242 - } catch (XMPPHP_Exception $e) {
26243 - $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
26247 + function handle_notice($notice) {
26249 + return jabber_broadcast_notice($notice);
26250 + } catch (XMPPHP_Exception $e) {
26251 + $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
26255 hunk ./scripts/maildaemon.php 23
26256 - print "This script must be run from the command line\n";
26258 + print "This script must be run from the command line\n";
26260 hunk ./scripts/maildaemon.php 39
26261 - function __construct() {
26263 + function __construct() {
26265 hunk ./scripts/maildaemon.php 42
26266 - function handle_message($fname='php://stdin') {
26267 - list($from, $to, $msg) = $this->parse_message($fname);
26268 - if (!$from || !$to || !$msg) {
26269 - $this->error(NULL, _('Could not parse message.'));
26271 - common_log(LOG_INFO, "Mail from $from to $to: " .substr($msg, 0, 20));
26272 - $user = $this->user_from($from);
26274 - $this->error($from, _('Not a registered user.'));
26277 - if (!$this->user_match_to($user, $to)) {
26278 - $this->error($from, _('Sorry, that is not your incoming email address.'));
26281 - if (!$user->emailpost) {
26282 - $this->error($from, _('Sorry, no incoming email allowed.'));
26285 - $response = $this->handle_command($user, $from, $msg);
26289 - $msg = $this->cleanup_msg($msg);
26290 - $this->add_notice($user, $msg);
26292 + function handle_message($fname='php://stdin') {
26293 + list($from, $to, $msg) = $this->parse_message($fname);
26294 + if (!$from || !$to || !$msg) {
26295 + $this->error(NULL, _('Could not parse message.'));
26297 + common_log(LOG_INFO, "Mail from $from to $to: " .substr($msg, 0, 20));
26298 + $user = $this->user_from($from);
26300 + $this->error($from, _('Not a registered user.'));
26303 + if (!$this->user_match_to($user, $to)) {
26304 + $this->error($from, _('Sorry, that is not your incoming email address.'));
26307 + if (!$user->emailpost) {
26308 + $this->error($from, _('Sorry, no incoming email allowed.'));
26311 + $response = $this->handle_command($user, $from, $msg);
26315 + $msg = $this->cleanup_msg($msg);
26316 + $this->add_notice($user, $msg);
26318 hunk ./scripts/maildaemon.php 69
26319 - function error($from, $msg) {
26320 - file_put_contents("php://stderr", $msg . "\n");
26323 + function error($from, $msg) {
26324 + file_put_contents("php://stderr", $msg . "\n");
26327 hunk ./scripts/maildaemon.php 74
26328 - function user_from($from_hdr) {
26329 - $froms = mailparse_rfc822_parse_addresses($from_hdr);
26333 - $from = $froms[0];
26334 - $addr = common_canonical_email($from['address']);
26335 - $user = User::staticGet('email', $addr);
26337 - $user = User::staticGet('smsemail', $addr);
26341 + function user_from($from_hdr) {
26342 + $froms = mailparse_rfc822_parse_addresses($from_hdr);
26346 + $from = $froms[0];
26347 + $addr = common_canonical_email($from['address']);
26348 + $user = User::staticGet('email', $addr);
26350 + $user = User::staticGet('smsemail', $addr);
26354 hunk ./scripts/maildaemon.php 88
26355 - function user_match_to($user, $to_hdr) {
26356 - $incoming = $user->incomingemail;
26357 - $tos = mailparse_rfc822_parse_addresses($to_hdr);
26358 - foreach ($tos as $to) {
26359 - if (strcasecmp($incoming, $to['address']) == 0) {
26365 + function user_match_to($user, $to_hdr) {
26366 + $incoming = $user->incomingemail;
26367 + $tos = mailparse_rfc822_parse_addresses($to_hdr);
26368 + foreach ($tos as $to) {
26369 + if (strcasecmp($incoming, $to['address']) == 0) {
26375 hunk ./scripts/maildaemon.php 99
26376 - function handle_command($user, $from, $msg) {
26377 - $inter = new CommandInterpreter();
26378 - $cmd = $inter->handle_command($user, $msg);
26380 - $cmd->execute(new MailChannel($from));
26385 + function handle_command($user, $from, $msg) {
26386 + $inter = new CommandInterpreter();
26387 + $cmd = $inter->handle_command($user, $msg);
26389 + $cmd->execute(new MailChannel($from));
26394 hunk ./scripts/maildaemon.php 109
26395 - function respond($from, $to, $response) {
26396 + function respond($from, $to, $response) {
26397 hunk ./scripts/maildaemon.php 111
26398 - $headers['From'] = $to;
26399 - $headers['To'] = $from;
26400 - $headers['Subject'] = "Command complete";
26401 + $headers['From'] = $to;
26402 + $headers['To'] = $from;
26403 + $headers['Subject'] = "Command complete";
26404 hunk ./scripts/maildaemon.php 115
26405 - return mail_send(array($from), $headers, $response);
26407 + return mail_send(array($from), $headers, $response);
26409 hunk ./scripts/maildaemon.php 118
26410 - function log($level, $msg) {
26411 - common_log($level, 'MailDaemon: '.$msg);
26413 + function log($level, $msg) {
26414 + common_log($level, 'MailDaemon: '.$msg);
26416 hunk ./scripts/maildaemon.php 122
26417 - function add_notice($user, $msg) {
26418 + function add_notice($user, $msg) {
26419 hunk ./scripts/maildaemon.php 126
26420 - $notice = Notice::saveNew($user->id, $msg, 'mail');
26421 - if (is_string($notice)) {
26422 - $this->log(LOG_ERR, $notice);
26425 - common_broadcast_notice($notice);
26426 - $this->log(LOG_INFO,
26427 - 'Added notice ' . $notice->id . ' from user ' . $user->nickname);
26429 + $notice = Notice::saveNew($user->id, $msg, 'mail');
26430 + if (is_string($notice)) {
26431 + $this->log(LOG_ERR, $notice);
26434 + common_broadcast_notice($notice);
26435 + $this->log(LOG_INFO,
26436 + 'Added notice ' . $notice->id . ' from user ' . $user->nickname);
26438 hunk ./scripts/maildaemon.php 136
26439 - function parse_message($fname) {
26440 - $contents = file_get_contents($fname);
26441 - $parsed = Mail_mimeDecode::decode(array('input' => $contents,
26442 - 'include_bodies' => true,
26443 - 'decode_headers' => true,
26444 - 'decode_bodies' => true));
26448 + function parse_message($fname) {
26449 + $contents = file_get_contents($fname);
26450 + $parsed = Mail_mimeDecode::decode(array('input' => $contents,
26451 + 'include_bodies' => true,
26452 + 'decode_headers' => true,
26453 + 'decode_bodies' => true));
26457 hunk ./scripts/maildaemon.php 146
26458 - $from = $parsed->headers['from'];
26459 + $from = $parsed->headers['from'];
26460 hunk ./scripts/maildaemon.php 148
26461 - $to = $parsed->headers['to'];
26462 + $to = $parsed->headers['to'];
26463 hunk ./scripts/maildaemon.php 150
26464 - $type = $parsed->ctype_primary . '/' . $parsed->ctype_secondary;
26465 + $type = $parsed->ctype_primary . '/' . $parsed->ctype_secondary;
26466 hunk ./scripts/maildaemon.php 152
26467 - if ($parsed->ctype_primary == 'multipart') {
26468 - foreach ($parsed->parts as $part) {
26469 - if ($part->ctype_primary == 'text' &&
26470 - $part->ctype_secondary == 'plain') {
26471 - $msg = $part->body;
26475 - } else if ($type == 'text/plain') {
26476 - $msg = $parsed->body;
26478 - $this->unsupported_type($type);
26480 + if ($parsed->ctype_primary == 'multipart') {
26481 + foreach ($parsed->parts as $part) {
26482 + if ($part->ctype_primary == 'text' &&
26483 + $part->ctype_secondary == 'plain') {
26484 + $msg = $part->body;
26488 + } else if ($type == 'text/plain') {
26489 + $msg = $parsed->body;
26491 + $this->unsupported_type($type);
26493 hunk ./scripts/maildaemon.php 166
26494 - return array($from, $to, $msg);
26496 + return array($from, $to, $msg);
26498 hunk ./scripts/maildaemon.php 169
26499 - function unsupported_type($type) {
26500 - $this->error(NULL, "Unsupported message type: " . $type);
26502 + function unsupported_type($type) {
26503 + $this->error(NULL, "Unsupported message type: " . $type);
26505 hunk ./scripts/maildaemon.php 173
26506 - function cleanup_msg($msg) {
26507 - $lines = explode("\n", $msg);
26508 + function cleanup_msg($msg) {
26509 + $lines = explode("\n", $msg);
26510 hunk ./scripts/maildaemon.php 176
26513 hunk ./scripts/maildaemon.php 178
26514 - foreach ($lines as $line) {
26516 - if (preg_match('/^\s*>.*$/', $line)) {
26519 - // skip start of quote
26520 - if (preg_match('/^\s*On.*wrote:\s*$/', $line)) {
26523 - // probably interesting to someone, not us
26524 - if (preg_match('/^\s*Sent via/', $line)) {
26527 - // skip everything after a sig
26528 - if (preg_match('/^\s*--+\s*$/', $line) ||
26529 - preg_match('/^\s*__+\s*$/', $line))
26533 - // skip everything after Outlook quote
26534 - if (preg_match('/^\s*-+\s*Original Message\s*-+\s*$/', $line)) {
26537 - // skip everything after weird forward
26538 - if (preg_match('/^\s*Begin\s+forward/', $line)) {
26541 + foreach ($lines as $line) {
26543 + if (preg_match('/^\s*>.*$/', $line)) {
26546 + // skip start of quote
26547 + if (preg_match('/^\s*On.*wrote:\s*$/', $line)) {
26550 + // probably interesting to someone, not us
26551 + if (preg_match('/^\s*Sent via/', $line)) {
26554 + // skip everything after a sig
26555 + if (preg_match('/^\s*--+\s*$/', $line) ||
26556 + preg_match('/^\s*__+\s*$/', $line))
26560 + // skip everything after Outlook quote
26561 + if (preg_match('/^\s*-+\s*Original Message\s*-+\s*$/', $line)) {
26564 + // skip everything after weird forward
26565 + if (preg_match('/^\s*Begin\s+forward/', $line)) {
26568 hunk ./scripts/maildaemon.php 206
26569 - $output .= ' ' . $line;
26571 + $output .= ' ' . $line;
26573 hunk ./scripts/maildaemon.php 209
26574 - preg_replace('/\s+/', ' ', $output);
26575 - return trim($output);
26577 + preg_replace('/\s+/', ' ', $output);
26578 + return trim($output);
26580 hunk ./scripts/ombqueuehandler.php 23
26581 - print "This script must be run from the command line\n";
26583 + print "This script must be run from the command line\n";
26585 hunk ./scripts/ombqueuehandler.php 37
26587 - function transport() {
26591 - function start() {
26592 - $this->log(LOG_INFO, "INITIALIZE");
26596 + function transport() {
26600 + function start() {
26601 + $this->log(LOG_INFO, "INITIALIZE");
26604 hunk ./scripts/ombqueuehandler.php 47
26605 - function handle_notice($notice) {
26606 - if ($this->is_remote($notice)) {
26607 - $this->log(LOG_DEBUG, 'Ignoring remote notice ' . $notice->id);
26610 - return omb_broadcast_remote_subscribers($notice);
26614 - function finish() {
26616 + function handle_notice($notice) {
26617 + if ($this->is_remote($notice)) {
26618 + $this->log(LOG_DEBUG, 'Ignoring remote notice ' . $notice->id);
26621 + return omb_broadcast_remote_subscribers($notice);
26625 + function finish() {
26627 hunk ./scripts/ombqueuehandler.php 59
26628 - function is_remote($notice) {
26629 - $user = User::staticGet($notice->profile_id);
26630 - return is_null($user);
26632 + function is_remote($notice) {
26633 + $user = User::staticGet($notice->profile_id);
26634 + return is_null($user);
26636 hunk ./scripts/publicqueuehandler.php 23
26637 - print "This script must be run from the command line\n";
26639 + print "This script must be run from the command line\n";
26641 hunk ./scripts/publicqueuehandler.php 37
26643 - function transport() {
26647 - function handle_notice($notice) {
26649 - return jabber_public_notice($notice);
26650 - } catch (XMPPHP_Exception $e) {
26651 - $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
26652 - die($e->getMessage());
26656 + function transport() {
26660 + function handle_notice($notice) {
26662 + return jabber_public_notice($notice);
26663 + } catch (XMPPHP_Exception $e) {
26664 + $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
26665 + die($e->getMessage());
26668 hunk ./scripts/sitemap.php 22
26669 - global $output_paths;
26670 - $output_dir = $output_paths['output_dir'];
26671 - $output_url = $output_paths['output_url'];
26672 + global $output_paths;
26673 + $output_dir = $output_paths['output_dir'];
26674 + $output_url = $output_paths['output_url'];
26675 hunk ./scripts/sitemap.php 26
26676 - foreach (glob("$output_dir*.xml") as $file_name) {
26677 + foreach (glob("$output_dir*.xml") as $file_name) {
26678 hunk ./scripts/sitemap.php 28
26679 - # Just the file name please.
26680 - $file_name = preg_replace("|$output_dir|", '', $file_name);
26681 + # Just the file name please.
26682 + $file_name = preg_replace("|$output_dir|", '', $file_name);
26683 hunk ./scripts/sitemap.php 31
26684 - $index_urls .= sitemap(
26686 - 'url' => $output_url . $file_name,
26687 - 'changefreq' => 'daily'
26691 + $index_urls .= sitemap(
26693 + 'url' => $output_url . $file_name,
26694 + 'changefreq' => 'daily'
26698 hunk ./scripts/sitemap.php 39
26699 - write_file($output_paths['index_file'], sitemapindex($index_urls));
26700 + write_file($output_paths['index_file'], sitemapindex($index_urls));
26701 hunk ./scripts/sitemap.php 44
26702 - global $output_paths;
26703 + global $output_paths;
26704 hunk ./scripts/sitemap.php 46
26705 - $standard_map_urls .= url(
26707 - 'url' => common_local_url('public'),
26708 - 'changefreq' => 'daily',
26709 - 'priority' => '1',
26712 + $standard_map_urls .= url(
26714 + 'url' => common_local_url('public'),
26715 + 'changefreq' => 'daily',
26716 + 'priority' => '1',
26719 hunk ./scripts/sitemap.php 54
26720 - $standard_map_urls .= url(
26722 - 'url' => common_local_url('publicrss'),
26723 - 'changefreq' => 'daily',
26724 - 'priority' => '0.3',
26727 + $standard_map_urls .= url(
26729 + 'url' => common_local_url('publicrss'),
26730 + 'changefreq' => 'daily',
26731 + 'priority' => '0.3',
26734 hunk ./scripts/sitemap.php 62
26735 - $docs = array('about', 'faq', 'contact', 'im', 'openid', 'openmublog', 'privacy', 'source');
26736 + $docs = array('about', 'faq', 'contact', 'im', 'openid', 'openmublog', 'privacy', 'source');
26737 hunk ./scripts/sitemap.php 64
26738 - foreach($docs as $title) {
26739 - $standard_map_urls .= url(
26741 - 'url' => common_local_url('doc', array('title' => $title)),
26742 - 'changefreq' => 'monthly',
26743 - 'priority' => '0.2',
26747 + foreach($docs as $title) {
26748 + $standard_map_urls .= url(
26750 + 'url' => common_local_url('doc', array('title' => $title)),
26751 + 'changefreq' => 'monthly',
26752 + 'priority' => '0.2',
26756 hunk ./scripts/sitemap.php 74
26757 - $urlset_path = $output_paths['output_dir'] . 'standard.xml';
26758 + $urlset_path = $output_paths['output_dir'] . 'standard.xml';
26759 hunk ./scripts/sitemap.php 76
26760 - write_file($urlset_path, urlset($standard_map_urls));
26761 + write_file($urlset_path, urlset($standard_map_urls));
26762 hunk ./scripts/sitemap.php 81
26763 - global $output_paths;
26764 + global $output_paths;
26765 hunk ./scripts/sitemap.php 83
26766 - $notices = DB_DataObject::factory('notice');
26767 + $notices = DB_DataObject::factory('notice');
26768 hunk ./scripts/sitemap.php 85
26769 - $notices->query('SELECT id, uri, url, modified FROM notice where is_local = 1');
26770 + $notices->query('SELECT id, uri, url, modified FROM notice where is_local = 1');
26771 hunk ./scripts/sitemap.php 87
26772 - $notice_count = 0;
26774 + $notice_count = 0;
26776 hunk ./scripts/sitemap.php 90
26777 - while ($notices->fetch()) {
26778 + while ($notices->fetch()) {
26779 hunk ./scripts/sitemap.php 92
26780 - # Maximum 50,000 URLs per sitemap file.
26781 - if ($notice_count == 50000) {
26782 - $notice_count = 0;
26785 + # Maximum 50,000 URLs per sitemap file.
26786 + if ($notice_count == 50000) {
26787 + $notice_count = 0;
26790 hunk ./scripts/sitemap.php 98
26791 - # remote notices have an URL
26793 - if (!$notices->url && $notices->uri) {
26795 - 'url' => ($notices->uri) ? $notices->uri : common_local_url('shownotice', array('notice' => $notices->id)),
26796 - 'lastmod' => common_date_w3dtf($notices->modified),
26797 - 'changefreq' => 'never',
26798 - 'priority' => '1',
26800 + # remote notices have an URL
26802 + if (!$notices->url && $notices->uri) {
26804 + 'url' => ($notices->uri) ? $notices->uri : common_local_url('shownotice', array('notice' => $notices->id)),
26805 + 'lastmod' => common_date_w3dtf($notices->modified),
26806 + 'changefreq' => 'never',
26807 + 'priority' => '1',
26809 hunk ./scripts/sitemap.php 108
26810 - $notice_list[$map_count] .= url($notice);
26814 + $notice_list[$map_count] .= url($notice);
26818 hunk ./scripts/sitemap.php 113
26819 - # Make full sitemaps from the lists and save them.
26820 - array_to_map($notice_list, 'notice');
26821 + # Make full sitemaps from the lists and save them.
26822 + array_to_map($notice_list, 'notice');
26823 hunk ./scripts/sitemap.php 119
26824 - global $output_paths;
26825 + global $output_paths;
26826 hunk ./scripts/sitemap.php 121
26827 - $users = DB_DataObject::factory('user');
26828 + $users = DB_DataObject::factory('user');
26829 hunk ./scripts/sitemap.php 123
26830 - $users->query('SELECT id, nickname FROM user');
26831 + $users->query('SELECT id, nickname FROM user');
26832 hunk ./scripts/sitemap.php 125
26837 hunk ./scripts/sitemap.php 128
26838 - while ($users->fetch()) {
26839 + while ($users->fetch()) {
26840 hunk ./scripts/sitemap.php 130
26841 - # Maximum 50,000 URLs per sitemap file.
26842 - if ($user_count == 50000) {
26846 + # Maximum 50,000 URLs per sitemap file.
26847 + if ($user_count == 50000) {
26851 hunk ./scripts/sitemap.php 136
26852 - $user_args = array('nickname' => $users->nickname);
26853 + $user_args = array('nickname' => $users->nickname);
26854 hunk ./scripts/sitemap.php 138
26855 - # Define parameters for generating <url></url> elements.
26857 - 'url' => common_local_url('showstream', $user_args),
26858 - 'changefreq' => 'daily',
26859 - 'priority' => '1',
26861 + # Define parameters for generating <url></url> elements.
26863 + 'url' => common_local_url('showstream', $user_args),
26864 + 'changefreq' => 'daily',
26865 + 'priority' => '1',
26867 hunk ./scripts/sitemap.php 145
26868 - $user_rss = array(
26869 - 'url' => common_local_url('userrss', $user_args),
26870 - 'changefreq' => 'daily',
26871 - 'priority' => '0.3',
26873 + $user_rss = array(
26874 + 'url' => common_local_url('userrss', $user_args),
26875 + 'changefreq' => 'daily',
26876 + 'priority' => '0.3',
26878 hunk ./scripts/sitemap.php 151
26880 - 'url' => common_local_url('all', $user_args),
26881 - 'changefreq' => 'daily',
26882 - 'priority' => '1',
26885 + 'url' => common_local_url('all', $user_args),
26886 + 'changefreq' => 'daily',
26887 + 'priority' => '1',
26889 hunk ./scripts/sitemap.php 157
26890 - $all_rss = array(
26891 - 'url' => common_local_url('allrss', $user_args),
26892 - 'changefreq' => 'daily',
26893 - 'priority' => '0.3',
26895 + $all_rss = array(
26896 + 'url' => common_local_url('allrss', $user_args),
26897 + 'changefreq' => 'daily',
26898 + 'priority' => '0.3',
26900 hunk ./scripts/sitemap.php 163
26901 - $replies = array(
26902 - 'url' => common_local_url('replies', $user_args),
26903 - 'changefreq' => 'daily',
26904 - 'priority' => '1',
26906 + $replies = array(
26907 + 'url' => common_local_url('replies', $user_args),
26908 + 'changefreq' => 'daily',
26909 + 'priority' => '1',
26911 hunk ./scripts/sitemap.php 169
26912 - $replies_rss = array(
26913 - 'url' => common_local_url('repliesrss', $user_args),
26914 - 'changefreq' => 'daily',
26915 - 'priority' => '0.3',
26917 + $replies_rss = array(
26918 + 'url' => common_local_url('repliesrss', $user_args),
26919 + 'changefreq' => 'daily',
26920 + 'priority' => '0.3',
26922 hunk ./scripts/sitemap.php 175
26924 - 'url' => common_local_url('foaf', $user_args),
26925 - 'changefreq' => 'weekly',
26926 - 'priority' => '0.5',
26929 + 'url' => common_local_url('foaf', $user_args),
26930 + 'changefreq' => 'weekly',
26931 + 'priority' => '0.5',
26933 hunk ./scripts/sitemap.php 181
26934 - # Construct a <url></url> element for each user facet and add it
26935 - # to our existing list of those.
26936 - $user_list[$map_count] .= url($user);
26937 - $user_rss_list[$map_count] .= url($user_rss);
26938 - $all_list[$map_count] .= url($all);
26939 - $all_rss_list[$map_count] .= url($all_rss);
26940 - $replies_list[$map_count] .= url($replies);
26941 - $replies_rss_list[$map_count] .= url($replies_rss);
26942 - $foaf_list[$map_count] .= url($foaf);
26943 + # Construct a <url></url> element for each user facet and add it
26944 + # to our existing list of those.
26945 + $user_list[$map_count] .= url($user);
26946 + $user_rss_list[$map_count] .= url($user_rss);
26947 + $all_list[$map_count] .= url($all);
26948 + $all_rss_list[$map_count] .= url($all_rss);
26949 + $replies_list[$map_count] .= url($replies);
26950 + $replies_rss_list[$map_count] .= url($replies_rss);
26951 + $foaf_list[$map_count] .= url($foaf);
26952 hunk ./scripts/sitemap.php 191
26957 hunk ./scripts/sitemap.php 194
26958 - # Make full sitemaps from the lists and save them.
26959 - # Possible factoring: put all the lists into a master array, thus allowing
26960 - # calling with single argument (i.e., array_to_map('user')).
26961 - array_to_map($user_list, 'user');
26962 - array_to_map($user_rss_list, 'user_rss');
26963 - array_to_map($all_list, 'all');
26964 - array_to_map($all_rss_list, 'all_rss');
26965 - array_to_map($replies_list, 'replies');
26966 - array_to_map($replies_rss_list, 'replies_rss');
26967 - array_to_map($foaf_list, 'foaf');
26968 + # Make full sitemaps from the lists and save them.
26969 + # Possible factoring: put all the lists into a master array, thus allowing
26970 + # calling with single argument (i.e., array_to_map('user')).
26971 + array_to_map($user_list, 'user');
26972 + array_to_map($user_rss_list, 'user_rss');
26973 + array_to_map($all_list, 'all');
26974 + array_to_map($all_rss_list, 'all_rss');
26975 + array_to_map($replies_list, 'replies');
26976 + array_to_map($replies_rss_list, 'replies_rss');
26977 + array_to_map($foaf_list, 'foaf');
26978 hunk ./scripts/sitemap.php 212
26979 - $url = preg_replace('/&/', '&', $url_args['url']); # escape ampersands for XML
26980 - $lastmod = $url_args['lastmod'];
26981 - $changefreq = $url_args['changefreq'];
26982 - $priority = $url_args['priority'];
26983 + $url = preg_replace('/&/', '&', $url_args['url']); # escape ampersands for XML
26984 + $lastmod = $url_args['lastmod'];
26985 + $changefreq = $url_args['changefreq'];
26986 + $priority = $url_args['priority'];
26987 hunk ./scripts/sitemap.php 217
26988 - if (is_null($url)) {
26989 - error("url() arguments require 'url' value.");
26991 + if (is_null($url)) {
26992 + error("url() arguments require 'url' value.");
26994 hunk ./scripts/sitemap.php 221
26995 - $url_out = "\t<url>\n";
26996 - $url_out .= "\t\t<loc>$url</loc>\n";
26997 + $url_out = "\t<url>\n";
26998 + $url_out .= "\t\t<loc>$url</loc>\n";
26999 hunk ./scripts/sitemap.php 224
27000 - if ($changefreq) {
27001 - $url_out .= "\t\t<changefreq>$changefreq</changefreq>\n";
27003 + if ($changefreq) {
27004 + $url_out .= "\t\t<changefreq>$changefreq</changefreq>\n";
27006 hunk ./scripts/sitemap.php 228
27008 - $url_out .= "\t\t<lastmod>$lastmod</lastmod>\n";
27011 + $url_out .= "\t\t<lastmod>$lastmod</lastmod>\n";
27013 hunk ./scripts/sitemap.php 232
27015 - $url_out .= "\t\t<priority>$priority</priority>\n";
27018 + $url_out .= "\t\t<priority>$priority</priority>\n";
27020 hunk ./scripts/sitemap.php 236
27021 - $url_out .= "\t</url>\n";
27022 + $url_out .= "\t</url>\n";
27023 hunk ./scripts/sitemap.php 238
27026 hunk ./scripts/sitemap.php 242
27027 - $url = preg_replace('/&/', '&', $sitemap_args['url']); # escape ampersands for XML
27028 - $lastmod = $sitemap_args['lastmod'];
27029 + $url = preg_replace('/&/', '&', $sitemap_args['url']); # escape ampersands for XML
27030 + $lastmod = $sitemap_args['lastmod'];
27031 hunk ./scripts/sitemap.php 245
27032 - if (is_null($url)) {
27033 - error("url() arguments require 'url' value.");
27035 + if (is_null($url)) {
27036 + error("url() arguments require 'url' value.");
27038 hunk ./scripts/sitemap.php 249
27039 - $sitemap_out = "\t<sitemap>\n";
27040 - $sitemap_out .= "\t\t<loc>$url</loc>\n";
27041 + $sitemap_out = "\t<sitemap>\n";
27042 + $sitemap_out .= "\t\t<loc>$url</loc>\n";
27043 hunk ./scripts/sitemap.php 252
27045 - $sitemap_out .= "\t\t<lastmod>$lastmod</lastmod>\n";
27048 + $sitemap_out .= "\t\t<lastmod>$lastmod</lastmod>\n";
27050 hunk ./scripts/sitemap.php 256
27051 - $sitemap_out .= "\t</sitemap>\n";
27052 + $sitemap_out .= "\t</sitemap>\n";
27053 hunk ./scripts/sitemap.php 258
27054 - return $sitemap_out;
27055 + return $sitemap_out;
27056 hunk ./scripts/sitemap.php 263
27057 - $urlset = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
27058 - '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
27061 + $urlset = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
27062 + '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
27065 hunk ./scripts/sitemap.php 268
27068 hunk ./scripts/sitemap.php 273
27069 - $sitemapindex = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
27070 - '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
27071 - $sitemapindex_text .
27072 - '</sitemapindex>';
27073 + $sitemapindex = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
27074 + '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" .
27075 + $sitemapindex_text .
27076 + '</sitemapindex>';
27077 hunk ./scripts/sitemap.php 278
27078 - return $sitemapindex;
27079 + return $sitemapindex;
27080 hunk ./scripts/sitemap.php 283
27081 - global $output_paths;
27082 + global $output_paths;
27083 hunk ./scripts/sitemap.php 285
27085 - # $map_urls is a long string containing concatenated <url></url> elements.
27086 - while (list($map_idx, $map_urls) = each($url_list)) {
27087 - $urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
27089 - write_file($urlset_path, urlset($map_urls));
27093 + # $map_urls is a long string containing concatenated <url></url> elements.
27094 + while (list($map_idx, $map_urls) = each($url_list)) {
27095 + $urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
27097 + write_file($urlset_path, urlset($map_urls));
27100 hunk ./scripts/sitemap.php 301
27101 - $args = getopt('f:d:u:');
27102 + $args = getopt('f:d:u:');
27103 hunk ./scripts/sitemap.php 303
27104 - if (is_null($args[f]) && is_null($args[d]) && is_null($args[u])) {
27105 - error('Mandatory arguments: -f <index file path> -d <output directory path> -u <URL of sitemaps directory>');
27107 + if (is_null($args[f]) && is_null($args[d]) && is_null($args[u])) {
27108 + error('Mandatory arguments: -f <index file path> -d <output directory path> -u <URL of sitemaps directory>');
27110 hunk ./scripts/sitemap.php 307
27111 - if (is_null($args[f])) {
27112 - error('You must specify an index file name with the -f option.');
27114 + if (is_null($args[f])) {
27115 + error('You must specify an index file name with the -f option.');
27117 hunk ./scripts/sitemap.php 311
27118 - if (is_null($args[d])) {
27119 - error('You must specify a directory for the output file with the -d option.');
27121 + if (is_null($args[d])) {
27122 + error('You must specify a directory for the output file with the -d option.');
27124 hunk ./scripts/sitemap.php 315
27125 - if (is_null($args[u])) {
27126 - error('You must specify a URL for the directory where the sitemaps will be kept with the -u option.');
27128 + if (is_null($args[u])) {
27129 + error('You must specify a URL for the directory where the sitemaps will be kept with the -u option.');
27131 hunk ./scripts/sitemap.php 319
27132 - $index_file = $args[f];
27133 - $output_dir = $args[d];
27134 - $output_url = $args[u];
27135 + $index_file = $args[f];
27136 + $output_dir = $args[d];
27137 + $output_url = $args[u];
27138 hunk ./scripts/sitemap.php 323
27139 - if (file_exists($output_dir)) {
27140 - if (is_writable($output_dir) === FALSE) {
27141 - error("$output_dir is not writable.");
27144 - error("output directory $output_dir does not exist.");
27146 + if (file_exists($output_dir)) {
27147 + if (is_writable($output_dir) === FALSE) {
27148 + error("$output_dir is not writable.");
27151 + error("output directory $output_dir does not exist.");
27153 hunk ./scripts/sitemap.php 331
27155 - 'index_file' => $index_file,
27156 - 'output_dir' => trailing_slash($output_dir),
27157 - 'output_url' => trailing_slash($output_url),
27160 + 'index_file' => $index_file,
27161 + 'output_dir' => trailing_slash($output_dir),
27162 + 'output_url' => trailing_slash($output_url),
27164 hunk ./scripts/sitemap.php 337
27167 hunk ./scripts/sitemap.php 342
27168 - if (preg_match('/\/$/', $path) == 0) {
27171 + if (preg_match('/\/$/', $path) == 0) {
27174 hunk ./scripts/sitemap.php 346
27177 hunk ./scripts/sitemap.php 351
27178 - if (is_null($path)) {
27179 - error('No path specified for writing to.');
27180 - } elseif (is_null($data)) {
27181 - error('No data specified for writing.');
27183 + if (is_null($path)) {
27184 + error('No path specified for writing to.');
27185 + } elseif (is_null($data)) {
27186 + error('No data specified for writing.');
27188 hunk ./scripts/sitemap.php 357
27189 - if (($fh_out = fopen($path,'w')) === FALSE) {
27190 - error("couldn't open $path for writing.");
27192 + if (($fh_out = fopen($path,'w')) === FALSE) {
27193 + error("couldn't open $path for writing.");
27195 hunk ./scripts/sitemap.php 361
27196 - if (fwrite($fh_out, $data) === FALSE) {
27197 - error("couldn't write to $path.");
27199 + if (fwrite($fh_out, $data) === FALSE) {
27200 + error("couldn't write to $path.");
27202 hunk ./scripts/sitemap.php 368
27203 - if (is_null($error_msg)) {
27204 - $error_msg = 'error() was called without any explanation!';
27206 + if (is_null($error_msg)) {
27207 + $error_msg = 'error() was called without any explanation!';
27209 hunk ./scripts/sitemap.php 372
27210 - echo "Error: $error_msg\n";
27212 + echo "Error: $error_msg\n";
27214 hunk ./scripts/smsqueuehandler.php 23
27215 - print "This script must be run from the command line\n";
27217 + print "This script must be run from the command line\n";
27219 hunk ./scripts/smsqueuehandler.php 37
27221 - function transport() {
27225 + function transport() {
27228 hunk ./scripts/smsqueuehandler.php 42
27229 - function start() {
27230 - $this->log(LOG_INFO, "INITIALIZE");
27233 + function start() {
27234 + $this->log(LOG_INFO, "INITIALIZE");
27237 hunk ./scripts/smsqueuehandler.php 47
27238 - function handle_notice($notice) {
27239 - return mail_broadcast_notice_sms($notice);
27242 - function finish() {
27244 + function handle_notice($notice) {
27245 + return mail_broadcast_notice_sms($notice);
27248 + function finish() {
27250 hunk ./scripts/synctwitterfriends.php 14
27251 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27252 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27253 hunk ./scripts/synctwitterfriends.php 18
27254 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
27255 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
27256 hunk ./scripts/synctwitterfriends.php 23
27257 - print "This script must be run from the command line\n";
27259 + print "This script must be run from the command line\n";
27261 hunk ./scripts/synctwitterfriends.php 38
27262 - if (($flink->friendsync & FOREIGN_FRIEND_RECV) == FOREIGN_FRIEND_RECV) {
27263 + if (($flink->friendsync & FOREIGN_FRIEND_RECV) == FOREIGN_FRIEND_RECV) {
27264 hunk ./scripts/synctwitterfriends.php 40
27265 - $user = User::staticGet($flink->user_id);
27266 + $user = User::staticGet($flink->user_id);
27267 hunk ./scripts/synctwitterfriends.php 42
27268 - print "Updating Twitter friends for user $user->nickname ($user->id)\n";
27269 + print "Updating Twitter friends for user $user->nickname ($user->id)\n";
27270 hunk ./scripts/synctwitterfriends.php 44
27271 - $fuser = $flink->getForeignUser();
27272 + $fuser = $flink->getForeignUser();
27273 hunk ./scripts/synctwitterfriends.php 46
27274 - $result = save_twitter_friends($user, $fuser->id, $fuser->nickname, $flink->credentials);
27275 + $result = save_twitter_friends($user, $fuser->id, $fuser->nickname, $flink->credentials);
27276 hunk ./scripts/synctwitterfriends.php 48
27277 - if ($result == false) {
27278 - print "Problems updating Twitter friends! Check the log.\n";
27282 + if ($result == false) {
27283 + print "Problems updating Twitter friends! Check the log.\n";
27287 hunk ./scripts/update_translations.php 8
27288 - 'da_DK' => 'http://laconi.ca/translate/download.php?file_id=23',
27289 - 'nl_NL' => 'http://laconi.ca/translate/download.php?file_id=39',
27290 - 'en_NZ' => 'http://laconi.ca/translate/download.php?file_id=15',
27291 - 'eo' => 'http://laconi.ca/translate/download.php?file_id=10',
27292 - 'fr_FR' => 'http://laconi.ca/translate/download.php?file_id=19',
27293 - 'de_DE' => 'http://laconi.ca/translate/download.php?file_id=18',
27294 - 'it_IT' => 'http://laconi.ca/translate/download.php?file_id=21',
27295 - 'ko' => 'http://laconi.ca/translate/download.php?file_id=33',
27296 - 'no_NB' => 'http://laconi.ca/translate/download.php?file_id=31',
27297 - 'pt' => 'http://laconi.ca/translate/download.php?file_id=8',
27298 - 'pt_BR' => 'http://laconi.ca/translate/download.php?file_id=72',
27299 - 'ru_RU' => 'http://laconi.ca/translate/download.php?file_id=26',
27300 - 'es' => 'http://laconi.ca/translate/download.php?file_id=9',
27301 - 'tr_TR' => 'http://laconi.ca/translate/download.php?file_id=37',
27302 - 'uk_UA' => 'http://laconi.ca/translate/download.php?file_id=44',
27303 - 'he_IL' => 'http://laconi.ca/translate/download.php?file_id=71',
27304 - 'mk_MK' => 'http://laconi.ca/translate/download.php?file_id=67',
27305 - 'ja_JP' => 'http://laconi.ca/translate/download.php?file_id=43',
27306 - 'cs_CZ' => 'http://laconi.ca/translate/download.php?file_id=63',
27307 - 'ca_ES' => 'http://laconi.ca/translate/download.php?file_id=49',
27308 - 'pl_PL' => 'http://laconi.ca/translate/download.php?file_id=51',
27309 - 'sv_SE' => 'http://laconi.ca/translate/download.php?file_id=55'
27310 + 'da_DK' => 'http://laconi.ca/translate/download.php?file_id=23',
27311 + 'nl_NL' => 'http://laconi.ca/translate/download.php?file_id=39',
27312 + 'en_NZ' => 'http://laconi.ca/translate/download.php?file_id=15',
27313 + 'eo' => 'http://laconi.ca/translate/download.php?file_id=10',
27314 + 'fr_FR' => 'http://laconi.ca/translate/download.php?file_id=19',
27315 + 'de_DE' => 'http://laconi.ca/translate/download.php?file_id=18',
27316 + 'it_IT' => 'http://laconi.ca/translate/download.php?file_id=21',
27317 + 'ko' => 'http://laconi.ca/translate/download.php?file_id=33',
27318 + 'no_NB' => 'http://laconi.ca/translate/download.php?file_id=31',
27319 + 'pt' => 'http://laconi.ca/translate/download.php?file_id=8',
27320 + 'pt_BR' => 'http://laconi.ca/translate/download.php?file_id=72',
27321 + 'ru_RU' => 'http://laconi.ca/translate/download.php?file_id=26',
27322 + 'es' => 'http://laconi.ca/translate/download.php?file_id=9',
27323 + 'tr_TR' => 'http://laconi.ca/translate/download.php?file_id=37',
27324 + 'uk_UA' => 'http://laconi.ca/translate/download.php?file_id=44',
27325 + 'he_IL' => 'http://laconi.ca/translate/download.php?file_id=71',
27326 + 'mk_MK' => 'http://laconi.ca/translate/download.php?file_id=67',
27327 + 'ja_JP' => 'http://laconi.ca/translate/download.php?file_id=43',
27328 + 'cs_CZ' => 'http://laconi.ca/translate/download.php?file_id=63',
27329 + 'ca_ES' => 'http://laconi.ca/translate/download.php?file_id=49',
27330 + 'pl_PL' => 'http://laconi.ca/translate/download.php?file_id=51',
27331 + 'sv_SE' => 'http://laconi.ca/translate/download.php?file_id=55'
27332 hunk ./scripts/update_translations.php 35
27333 - $lcdir='locale/'.$code;
27334 - $msgdir=$lcdir.'/LC_MESSAGES';
27335 - $pofile=$msgdir.'/laconica.po';
27336 - $mofile=$msgdir.'/laconica.mo';
27337 + $lcdir='locale/'.$code;
27338 + $msgdir=$lcdir.'/LC_MESSAGES';
27339 + $pofile=$msgdir.'/laconica.po';
27340 + $mofile=$msgdir.'/laconica.mo';
27341 hunk ./scripts/update_translations.php 40
27342 - /* Check for an existing */
27343 - if (!is_dir($msgdir)) {
27346 - $existingSHA1 = '';
27348 - $existingSHA1 = file_exists($pofile) ? sha1_file($pofile) : '';
27350 + /* Check for an existing */
27351 + if (!is_dir($msgdir)) {
27354 + $existingSHA1 = '';
27356 + $existingSHA1 = file_exists($pofile) ? sha1_file($pofile) : '';
27358 hunk ./scripts/update_translations.php 49
27359 - /* Get the remote one */
27360 - $newFile = file_get_contents($file);
27361 + /* Get the remote one */
27362 + $newFile = file_get_contents($file);
27363 hunk ./scripts/update_translations.php 52
27364 - // Update if the local .po file is different to the one downloaded, or
27365 - // if the .mo file is not present.
27366 - if(sha1($newFile)!=$existingSHA1 || !file_exists($mofile)) {
27367 - echo "Updating ".$code."\n";
27368 - file_put_contents($pofile, $newFile);
27369 - $prevdir = getcwd();
27371 - system('msgmerge -U laconica.po ../../laconica.pot');
27372 - system('msgfmt -f -o laconica.mo laconica.po');
27375 - echo "Unchanged - ".$code."\n";
27377 + // Update if the local .po file is different to the one downloaded, or
27378 + // if the .mo file is not present.
27379 + if(sha1($newFile)!=$existingSHA1 || !file_exists($mofile)) {
27380 + echo "Updating ".$code."\n";
27381 + file_put_contents($pofile, $newFile);
27382 + $prevdir = getcwd();
27384 + system('msgmerge -U laconica.po ../../laconica.pot');
27385 + system('msgfmt -f -o laconica.mo laconica.po');
27388 + echo "Unchanged - ".$code."\n";
27390 hunk ./scripts/xmppconfirmhandler.php 23
27391 - print "This script must be run from the command line\n";
27393 + print "This script must be run from the command line\n";
27395 hunk ./scripts/xmppconfirmhandler.php 40
27396 - var $_id = 'confirm';
27398 - function class_name() {
27399 - return 'XmppConfirmHandler';
27403 - if (!$this->start()) {
27406 - $this->log(LOG_INFO, 'checking for queued confirmations');
27408 - $confirm = $this->next_confirm();
27410 - $this->log(LOG_INFO, 'Sending confirmation for ' . $confirm->address);
27411 - $user = User::staticGet($confirm->user_id);
27413 - $this->log(LOG_WARNING, 'Confirmation for unknown user ' . $confirm->user_id);
27416 - $success = jabber_confirm_address($confirm->code,
27418 - $confirm->address);
27420 - $this->log(LOG_ERR, 'Confirmation failed for ' . $confirm->address);
27421 - # Just let the claim age out; hopefully things work then
27424 - $this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address);
27425 - # Mark confirmation sent; need a dupe so we don't have the WHERE clause
27426 - $dupe = Confirm_address::staticGet('code', $confirm->code);
27428 - common_log(LOG_WARNING, 'Could not refetch confirm', __FILE__);
27431 - $orig = clone($dupe);
27432 - $dupe->sent = $dupe->claimed;
27433 - $result = $dupe->update($orig);
27435 - common_log_db_error($dupe, 'UPDATE', __FILE__);
27436 - # Just let the claim age out; hopefully things work then
27444 - $confirm->free();
27448 -# $this->clear_old_confirm_claims();
27452 - if (!$this->finish()) {
27457 + var $_id = 'confirm';
27459 + function class_name() {
27460 + return 'XmppConfirmHandler';
27464 + if (!$this->start()) {
27467 + $this->log(LOG_INFO, 'checking for queued confirmations');
27469 + $confirm = $this->next_confirm();
27471 + $this->log(LOG_INFO, 'Sending confirmation for ' . $confirm->address);
27472 + $user = User::staticGet($confirm->user_id);
27474 + $this->log(LOG_WARNING, 'Confirmation for unknown user ' . $confirm->user_id);
27477 + $success = jabber_confirm_address($confirm->code,
27479 + $confirm->address);
27481 + $this->log(LOG_ERR, 'Confirmation failed for ' . $confirm->address);
27482 + # Just let the claim age out; hopefully things work then
27485 + $this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address);
27486 + # Mark confirmation sent; need a dupe so we don't have the WHERE clause
27487 + $dupe = Confirm_address::staticGet('code', $confirm->code);
27489 + common_log(LOG_WARNING, 'Could not refetch confirm', __FILE__);
27492 + $orig = clone($dupe);
27493 + $dupe->sent = $dupe->claimed;
27494 + $result = $dupe->update($orig);
27496 + common_log_db_error($dupe, 'UPDATE', __FILE__);
27497 + # Just let the claim age out; hopefully things work then
27505 + $confirm->free();
27509 +# $this->clear_old_confirm_claims();
27513 + if (!$this->finish()) {
27518 hunk ./scripts/xmppconfirmhandler.php 102
27519 - function next_confirm() {
27520 - $confirm = new Confirm_address();
27521 - $confirm->whereAdd('claimed IS NULL');
27522 - $confirm->whereAdd('sent IS NULL');
27523 - # XXX: eventually we could do other confirmations in the queue, too
27524 - $confirm->address_type = 'jabber';
27525 - $confirm->orderBy('modified DESC');
27526 - $confirm->limit(1);
27527 - if ($confirm->find(TRUE)) {
27528 - $this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address);
27529 - # working around some weird DB_DataObject behaviour
27530 - $confirm->whereAdd(''); # clears where stuff
27531 - $original = clone($confirm);
27532 - $confirm->claimed = common_sql_now();
27533 - $result = $confirm->update($original);
27535 - $this->log(LOG_INFO, 'Succeeded in claim! '. $result);
27538 - $this->log(LOG_INFO, 'Failed in claim!');
27544 + function next_confirm() {
27545 + $confirm = new Confirm_address();
27546 + $confirm->whereAdd('claimed IS NULL');
27547 + $confirm->whereAdd('sent IS NULL');
27548 + # XXX: eventually we could do other confirmations in the queue, too
27549 + $confirm->address_type = 'jabber';
27550 + $confirm->orderBy('modified DESC');
27551 + $confirm->limit(1);
27552 + if ($confirm->find(TRUE)) {
27553 + $this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address);
27554 + # working around some weird DB_DataObject behaviour
27555 + $confirm->whereAdd(''); # clears where stuff
27556 + $original = clone($confirm);
27557 + $confirm->claimed = common_sql_now();
27558 + $result = $confirm->update($original);
27560 + $this->log(LOG_INFO, 'Succeeded in claim! '. $result);
27563 + $this->log(LOG_INFO, 'Failed in claim!');
27569 hunk ./scripts/xmppconfirmhandler.php 128
27570 - function clear_old_confirm_claims() {
27571 - $confirm = new Confirm();
27572 - $confirm->claimed = NULL;
27573 - $confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
27574 - $confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
27575 - $confirm->free();
27578 + function clear_old_confirm_claims() {
27579 + $confirm = new Confirm();
27580 + $confirm->claimed = NULL;
27581 + $confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
27582 + $confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
27583 + $confirm->free();
27586 hunk ./scripts/xmppdaemon.php 23
27587 - print "This script must be run from the command line\n";
27589 + print "This script must be run from the command line\n";
27591 hunk ./scripts/xmppdaemon.php 42
27592 - function XMPPDaemon($resource=NULL) {
27593 - static $attrs = array('server', 'port', 'user', 'password', 'host');
27594 + function XMPPDaemon($resource=NULL) {
27595 + static $attrs = array('server', 'port', 'user', 'password', 'host');
27596 hunk ./scripts/xmppdaemon.php 45
27597 - foreach ($attrs as $attr)
27599 - $this->$attr = common_config('xmpp', $attr);
27601 + foreach ($attrs as $attr)
27603 + $this->$attr = common_config('xmpp', $attr);
27605 hunk ./scripts/xmppdaemon.php 50
27607 - $this->resource = $resource;
27609 - $this->resource = common_config('xmpp', 'resource') . 'daemon';
27612 + $this->resource = $resource;
27614 + $this->resource = common_config('xmpp', 'resource') . 'daemon';
27616 hunk ./scripts/xmppdaemon.php 56
27617 - $this->log(LOG_INFO, "INITIALIZE XMPPDaemon {$this->user}@{$this->server}/{$this->resource}");
27619 + $this->log(LOG_INFO, "INITIALIZE XMPPDaemon {$this->user}@{$this->server}/{$this->resource}");
27621 hunk ./scripts/xmppdaemon.php 59
27622 - function connect() {
27623 + function connect() {
27624 hunk ./scripts/xmppdaemon.php 61
27625 - $connect_to = ($this->host) ? $this->host : $this->server;
27626 + $connect_to = ($this->host) ? $this->host : $this->server;
27627 hunk ./scripts/xmppdaemon.php 63
27628 - $this->log(LOG_INFO, "Connecting to $connect_to on port $this->port");
27629 + $this->log(LOG_INFO, "Connecting to $connect_to on port $this->port");
27630 hunk ./scripts/xmppdaemon.php 65
27631 - $this->conn = jabber_connect($this->resource);
27632 + $this->conn = jabber_connect($this->resource);
27633 hunk ./scripts/xmppdaemon.php 67
27634 - if (!$this->conn) {
27637 + if (!$this->conn) {
27640 hunk ./scripts/xmppdaemon.php 71
27641 - $this->conn->setReconnectTimeout(600);
27642 + $this->conn->setReconnectTimeout(600);
27643 hunk ./scripts/xmppdaemon.php 73
27644 - jabber_send_presence("Send me a message to post a notice", 'available',
27645 - NULL, 'available', 100);
27646 - return !$this->conn->isDisconnected();
27648 + jabber_send_presence("Send me a message to post a notice", 'available',
27649 + NULL, 'available', 100);
27650 + return !$this->conn->isDisconnected();
27652 hunk ./scripts/xmppdaemon.php 78
27653 - function name() {
27654 - return strtolower('xmppdaemon.'.$this->resource);
27656 + function name() {
27657 + return strtolower('xmppdaemon.'.$this->resource);
27659 hunk ./scripts/xmppdaemon.php 82
27661 - if ($this->connect()) {
27663 + if ($this->connect()) {
27664 hunk ./scripts/xmppdaemon.php 85
27665 - $this->conn->addEventHandler('message', 'handle_message', $this);
27666 - $this->conn->addEventHandler('presence', 'handle_presence', $this);
27667 - $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
27668 + $this->conn->addEventHandler('message', 'handle_message', $this);
27669 + $this->conn->addEventHandler('presence', 'handle_presence', $this);
27670 + $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
27671 hunk ./scripts/xmppdaemon.php 89
27672 - $this->conn->process();
27675 + $this->conn->process();
27678 hunk ./scripts/xmppdaemon.php 93
27679 - function handle_reconnect(&$pl) {
27680 - $this->conn->processUntil('session_start');
27681 - $this->conn->presence('Send me a message to post a notice', 'available', NULL, 'available', 100);
27683 + function handle_reconnect(&$pl) {
27684 + $this->conn->processUntil('session_start');
27685 + $this->conn->presence('Send me a message to post a notice', 'available', NULL, 'available', 100);
27687 hunk ./scripts/xmppdaemon.php 98
27688 - function get_user($from) {
27689 - $user = User::staticGet('jabber', jabber_normalize_jid($from));
27692 + function get_user($from) {
27693 + $user = User::staticGet('jabber', jabber_normalize_jid($from));
27696 hunk ./scripts/xmppdaemon.php 103
27697 - function handle_message(&$pl) {
27698 - if ($pl['type'] != 'chat') {
27701 - if (mb_strlen($pl['body']) == 0) {
27704 + function handle_message(&$pl) {
27705 + if ($pl['type'] != 'chat') {
27708 + if (mb_strlen($pl['body']) == 0) {
27711 hunk ./scripts/xmppdaemon.php 111
27712 - $from = jabber_normalize_jid($pl['from']);
27713 + $from = jabber_normalize_jid($pl['from']);
27714 hunk ./scripts/xmppdaemon.php 113
27715 - # Forwarded from another daemon (probably a broadcaster) for
27717 + # Forwarded from another daemon (probably a broadcaster) for
27719 hunk ./scripts/xmppdaemon.php 116
27720 - if ($this->is_self($from)) {
27721 - $from = $this->get_ofrom($pl);
27722 - if (is_null($from) || $this->is_self($from)) {
27726 + if ($this->is_self($from)) {
27727 + $from = $this->get_ofrom($pl);
27728 + if (is_null($from) || $this->is_self($from)) {
27732 hunk ./scripts/xmppdaemon.php 123
27733 - $user = $this->get_user($from);
27734 + $user = $this->get_user($from);
27735 hunk ./scripts/xmppdaemon.php 125
27737 - $this->from_site($from, 'Unknown user; go to ' .
27738 - common_local_url('imsettings') .
27739 - ' to add your address to your account');
27740 - $this->log(LOG_WARNING, 'Message from unknown user ' . $from);
27743 - if ($this->handle_command($user, $pl['body'])) {
27745 - } else if ($this->is_autoreply($pl['body'])) {
27746 - $this->log(LOG_INFO, 'Ignoring auto reply from ' . $from);
27748 - } else if ($this->is_otr($pl['body'])) {
27749 - $this->log(LOG_INFO, 'Ignoring OTR from ' . $from);
27751 - } else if ($this->is_direct($pl['body'])) {
27752 - preg_match_all('/d[\ ]*([a-z0-9]{1,64})/', $pl['body'], $to);
27754 + $this->from_site($from, 'Unknown user; go to ' .
27755 + common_local_url('imsettings') .
27756 + ' to add your address to your account');
27757 + $this->log(LOG_WARNING, 'Message from unknown user ' . $from);
27760 + if ($this->handle_command($user, $pl['body'])) {
27762 + } else if ($this->is_autoreply($pl['body'])) {
27763 + $this->log(LOG_INFO, 'Ignoring auto reply from ' . $from);
27765 + } else if ($this->is_otr($pl['body'])) {
27766 + $this->log(LOG_INFO, 'Ignoring OTR from ' . $from);
27768 + } else if ($this->is_direct($pl['body'])) {
27769 + preg_match_all('/d[\ ]*([a-z0-9]{1,64})/', $pl['body'], $to);
27770 hunk ./scripts/xmppdaemon.php 143
27771 - $to = preg_replace('/^d([\ ])*/', '', $to[0][0]);
27772 - $body = preg_replace('/d[\ ]*('. $to .')[\ ]*/', '', $pl['body']);
27773 - $this->add_direct($user, $body, $to, $from);
27775 - $len = mb_strlen($pl['body']);
27777 - $this->from_site($from, 'Message too long - maximum is 140 characters, you sent ' . $len);
27780 - $this->add_notice($user, $pl);
27782 + $to = preg_replace('/^d([\ ])*/', '', $to[0][0]);
27783 + $body = preg_replace('/d[\ ]*('. $to .')[\ ]*/', '', $pl['body']);
27784 + $this->add_direct($user, $body, $to, $from);
27786 + $len = mb_strlen($pl['body']);
27788 + $this->from_site($from, 'Message too long - maximum is 140 characters, you sent ' . $len);
27791 + $this->add_notice($user, $pl);
27793 hunk ./scripts/xmppdaemon.php 155
27800 hunk ./scripts/xmppdaemon.php 159
27801 - function is_self($from) {
27802 - return preg_match('/^'.strtolower(jabber_daemon_address()).'/', strtolower($from));
27804 + function is_self($from) {
27805 + return preg_match('/^'.strtolower(jabber_daemon_address()).'/', strtolower($from));
27807 hunk ./scripts/xmppdaemon.php 163
27808 - function get_ofrom($pl) {
27809 - $xml = $pl['xml'];
27810 - $addresses = $xml->sub('addresses');
27811 - if (!$addresses) {
27812 - $this->log(LOG_WARNING, 'Forwarded message without addresses');
27815 - $address = $addresses->sub('address');
27817 - $this->log(LOG_WARNING, 'Forwarded message without address');
27820 - if (!array_key_exists('type', $address->attrs)) {
27821 - $this->log(LOG_WARNING, 'No type for forwarded message');
27824 - $type = $address->attrs['type'];
27825 - if ($type != 'ofrom') {
27826 - $this->log(LOG_WARNING, 'Type of forwarded message is not ofrom');
27829 - if (!array_key_exists('jid', $address->attrs)) {
27830 - $this->log(LOG_WARNING, 'No jid for forwarded message');
27833 - $jid = $address->attrs['jid'];
27835 - $this->log(LOG_WARNING, 'Could not get jid from address');
27838 - $this->log(LOG_DEBUG, 'Got message forwarded from jid ' . $jid);
27841 + function get_ofrom($pl) {
27842 + $xml = $pl['xml'];
27843 + $addresses = $xml->sub('addresses');
27844 + if (!$addresses) {
27845 + $this->log(LOG_WARNING, 'Forwarded message without addresses');
27848 + $address = $addresses->sub('address');
27850 + $this->log(LOG_WARNING, 'Forwarded message without address');
27853 + if (!array_key_exists('type', $address->attrs)) {
27854 + $this->log(LOG_WARNING, 'No type for forwarded message');
27857 + $type = $address->attrs['type'];
27858 + if ($type != 'ofrom') {
27859 + $this->log(LOG_WARNING, 'Type of forwarded message is not ofrom');
27862 + if (!array_key_exists('jid', $address->attrs)) {
27863 + $this->log(LOG_WARNING, 'No jid for forwarded message');
27866 + $jid = $address->attrs['jid'];
27868 + $this->log(LOG_WARNING, 'Could not get jid from address');
27871 + $this->log(LOG_DEBUG, 'Got message forwarded from jid ' . $jid);
27874 hunk ./scripts/xmppdaemon.php 197
27875 - function is_autoreply($txt) {
27876 - if (preg_match('/[\[\(]?[Aa]uto[-\s]?[Rr]e(ply|sponse)[\]\)]/', $txt)) {
27882 + function is_autoreply($txt) {
27883 + if (preg_match('/[\[\(]?[Aa]uto[-\s]?[Rr]e(ply|sponse)[\]\)]/', $txt)) {
27889 hunk ./scripts/xmppdaemon.php 205
27890 - function is_otr($txt) {
27891 - if (preg_match('/^\?OTR/', $txt)) {
27897 + function is_otr($txt) {
27898 + if (preg_match('/^\?OTR/', $txt)) {
27904 hunk ./scripts/xmppdaemon.php 213
27905 - function is_direct($txt) {
27906 - if (strtolower(substr($txt, 0, 2))=='d ') {
27912 + function is_direct($txt) {
27913 + if (strtolower(substr($txt, 0, 2))=='d ') {
27919 hunk ./scripts/xmppdaemon.php 221
27920 - function from_site($address, $msg) {
27921 - $text = '['.common_config('site', 'name') . '] ' . $msg;
27922 - jabber_send_message($address, $text);
27924 + function from_site($address, $msg) {
27925 + $text = '['.common_config('site', 'name') . '] ' . $msg;
27926 + jabber_send_message($address, $text);
27928 hunk ./scripts/xmppdaemon.php 226
27929 - function handle_command($user, $body) {
27930 - $inter = new CommandInterpreter();
27931 - $cmd = $inter->handle_command($user, $body);
27933 - $chan = new XMPPChannel($this->conn);
27934 - $cmd->execute($chan);
27940 + function handle_command($user, $body) {
27941 + $inter = new CommandInterpreter();
27942 + $cmd = $inter->handle_command($user, $body);
27944 + $chan = new XMPPChannel($this->conn);
27945 + $cmd->execute($chan);
27951 hunk ./scripts/xmppdaemon.php 238
27952 - function add_notice(&$user, &$pl) {
27953 + function add_notice(&$user, &$pl) {
27954 hunk ./scripts/xmppdaemon.php 248
27955 - $notice = Notice::saveNew($user->id, $content, 'xmpp');
27956 - if (is_string($notice)) {
27957 - $this->log(LOG_ERR, $notice);
27960 - common_broadcast_notice($notice);
27961 - $this->log(LOG_INFO,
27962 - 'Added notice ' . $notice->id . ' from user ' . $user->nickname);
27966 + $notice = Notice::saveNew($user->id, $content, 'xmpp');
27967 + if (is_string($notice)) {
27968 + $this->log(LOG_ERR, $notice);
27971 + common_broadcast_notice($notice);
27972 + $this->log(LOG_INFO,
27973 + 'Added notice ' . $notice->id . ' from user ' . $user->nickname);
27977 hunk ./scripts/xmppdaemon.php 260
27978 - function handle_presence(&$pl) {
27979 - $from = jabber_normalize_jid($pl['from']);
27980 - switch ($pl['type']) {
27981 - case 'subscribe':
27982 - # We let anyone subscribe
27983 - $this->subscribed($from);
27984 - $this->log(LOG_INFO,
27985 - 'Accepted subscription from ' . $from);
27987 - case 'subscribed':
27988 - case 'unsubscribed':
27989 - case 'unsubscribe':
27990 - $this->log(LOG_INFO,
27991 - 'Ignoring "' . $pl['type'] . '" from ' . $from);
27994 - if (!$pl['type']) {
27995 - $user = User::staticGet('jabber', $from);
27997 - $this->log(LOG_WARNING, 'Presence from unknown user ' . $from);
28000 - if ($user->updatefrompresence) {
28001 - $this->log(LOG_INFO, 'Updating ' . $user->nickname .
28002 - ' status from presence.');
28003 - $this->add_notice($user, $pl);
28011 + function handle_presence(&$pl) {
28012 + $from = jabber_normalize_jid($pl['from']);
28013 + switch ($pl['type']) {
28014 + case 'subscribe':
28015 + # We let anyone subscribe
28016 + $this->subscribed($from);
28017 + $this->log(LOG_INFO,
28018 + 'Accepted subscription from ' . $from);
28020 + case 'subscribed':
28021 + case 'unsubscribed':
28022 + case 'unsubscribe':
28023 + $this->log(LOG_INFO,
28024 + 'Ignoring "' . $pl['type'] . '" from ' . $from);
28027 + if (!$pl['type']) {
28028 + $user = User::staticGet('jabber', $from);
28030 + $this->log(LOG_WARNING, 'Presence from unknown user ' . $from);
28033 + if ($user->updatefrompresence) {
28034 + $this->log(LOG_INFO, 'Updating ' . $user->nickname .
28035 + ' status from presence.');
28036 + $this->add_notice($user, $pl);
28044 hunk ./scripts/xmppdaemon.php 294
28045 - function log($level, $msg) {
28046 - common_log($level, 'XMPPDaemon('.$this->resource.'): '.$msg);
28048 + function log($level, $msg) {
28049 + common_log($level, 'XMPPDaemon('.$this->resource.'): '.$msg);
28051 hunk ./scripts/xmppdaemon.php 298
28052 - function subscribed($to) {
28053 - jabber_special_presence('subscribed', $to);
28055 + function subscribed($to) {
28056 + jabber_special_presence('subscribed', $to);