From 50711040cbf3686f427e5ad8d0582674ef45a12b Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 28 Mar 2012 15:31:58 +0200 Subject: message: remove tabs, move new message link to aside, all message with gmail-style --- mod/message.php | 115 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 74 insertions(+), 41 deletions(-) (limited to 'mod') diff --git a/mod/message.php b/mod/message.php index 8991f643d..949e5616c 100755 --- a/mod/message.php +++ b/mod/message.php @@ -3,6 +3,35 @@ require_once('include/acl_selectors.php'); require_once('include/message.php'); +function message_init(&$a) { + $tabs = array( + /* + array( + 'label' => t('All'), + 'url'=> $a->get_baseurl(true) . '/message', + 'sel'=> ($a->argc == 1), + ), + array( + 'label' => t('Sent'), + 'url' => $a->get_baseurl(true) . '/message/sent', + 'sel'=> ($a->argv[1] == 'sent'), + ), + */ + ); + $new = array( + 'label' => t('New Message'), + 'url' => $a->get_baseurl(true) . '/message/new', + 'sel'=> ($a->argv[1] == 'new'), + ); + + $tpl = get_markup_template('message_side.tpl'); + $a->page['aside'] = replace_macros($tpl, array( + '$tabs'=>$tabs, + '$new'=>$new, + )); + +} + function message_post(&$a) { if(! local_user()) { @@ -66,25 +95,7 @@ function message_content(&$a) { $myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname']; - $tabs = array( - array( - 'label' => t('Inbox'), - 'url'=> $a->get_baseurl(true) . '/message', - 'sel'=> (($a->argc == 1) ? 'active' : ''), - ), - array( - 'label' => t('Outbox'), - 'url' => $a->get_baseurl(true) . '/message/sent', - 'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''), - ), - array( - 'label' => t('New Message'), - 'url' => $a->get_baseurl(true) . '/message/new', - 'sel'=> (($a->argv[1] == 'new') ? 'active' : ''), - ), - ); - $tpl = get_markup_template('common_tabs.tpl'); - $tab_content = replace_macros($tpl, array('$tabs'=>$tabs)); + $tpl = get_markup_template('mail_head.tpl'); @@ -186,9 +197,9 @@ function message_content(&$a) { $o .= $header; if($a->argc == 2) - $eq = '='; // I'm not going to bother escaping this. + $eq = sprintf( "AND `from-url` = '%s'", dbesc($myprofile)); else - $eq = '!='; // or this. + $eq = ''; $r = q("SELECT count(*) AS `total` FROM `mail` WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `created` DESC", @@ -199,11 +210,12 @@ function message_content(&$a) { $a->set_pager_total($r[0]['total']); $r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`, - `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network` + `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`, + count( * ) as count FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` - WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", + WHERE `mail`.`uid` = %d $eq GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", intval(local_user()), - dbesc($myprofile), + // intval($a->pager['start']), intval($a->pager['itemspage']) ); @@ -214,9 +226,15 @@ function message_content(&$a) { $tpl = get_markup_template('mail_list.tpl'); foreach($r as $rr) { + if ($rr['from-url'] == $myprofile){ + $partecipants = sprintf( t("You and %s"), $rr['name']); + } else { + $partecipants = sprintf( t("%s and You"), $rr['from-name']); + } + $o .= replace_macros($tpl, array( '$id' => $rr['id'], - '$from_name' =>$rr['from-name'], + '$from_name' => $partecipants, '$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']), '$sparkle' => ' sparkle', '$from_photo' => $rr['thumb'], @@ -224,7 +242,9 @@ function message_content(&$a) { '$delete' => t('Delete conversation'), '$body' => template_escape($rr['body']), '$to_name' => template_escape($rr['name']), - '$date' => datetime_convert('UTC',date_default_timezone_get(),$rr['mailcreated'], t('D, d M Y - g:i A')) + '$date' => datetime_convert('UTC',date_default_timezone_get(),$rr['mailcreated'], t('D, d M Y - g:i A')), + '$seen' => $rr['mailseen'], + '$count' => sprintf( tt('%d message', '%d messages', $rr['count']), $rr['count']), )); } $o .= paginate($a); @@ -278,7 +298,8 @@ function message_content(&$a) { )); - $tpl = get_markup_template('mail_conv.tpl'); + $mails = array(); + $seen = 0; foreach($messages as $message) { if($message['from-url'] == $myprofile) { $from_url = $myprofile; @@ -288,24 +309,35 @@ function message_content(&$a) { $from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id']; $sparkle = ' sparkle'; } - $o .= replace_macros($tpl, array( - '$id' => $message['id'], - '$from_name' => template_escape($message['from-name']), - '$from_url' => $from_url, - '$sparkle' => $sparkle, - '$from_photo' => $message['from-photo'], - '$subject' => template_escape($message['title']), - '$body' => template_escape(smilies(bbcode($message['body']))), - '$delete' => t('Delete message'), - '$to_name' => template_escape($message['name']), - '$date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A') - )); + $mails[] = array( + 'id' => $message['id'], + 'from_name' => template_escape($message['from-name']), + 'from_url' => $from_url, + 'sparkle' => $sparkle, + 'from_photo' => $message['from-photo'], + 'subject' => template_escape($message['title']), + 'body' => template_escape(smilies(bbcode($message['body']))), + 'delete' => t('Delete message'), + 'to_name' => template_escape($message['name']), + 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'), + ); + $seen = $message['seen']; } $select = $message['name'] . ''; $parent = ''; - $tpl = get_markup_template('prv_message.tpl'); - $o .= replace_macros($tpl,array( + + + $tpl = get_markup_template('mail_display.tpl'); + $o = replace_macros($tpl, array( + '$thread_id' => $a->argv[1], + '$thread_subject' => $message['title'], + '$thread_seen' => $seen, + '$delete' => t('Delete conversation'), + + '$mails' => $mails, + + // reply '$header' => t('Send Reply'), '$to' => t('To:'), '$subject' => t('Subject:'), @@ -318,6 +350,7 @@ function message_content(&$a) { '$upload' => t('Upload photo'), '$insert' => t('Insert web link'), '$wait' => t('Please wait') + )); return $o; -- cgit v1.2.3 From 4fe0b56d765d98b79592cf855d72e823d4478854 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 Mar 2012 14:54:00 -0700 Subject: bug #349 - email notls setting --- mod/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index 99bf8842d..db7330fb5 100755 --- a/mod/settings.php +++ b/mod/settings.php @@ -618,7 +618,7 @@ function settings_content(&$a) { '$mail_disabled' => (($mail_disabled) ? t('Email access is disabled on this site.') : ''), '$mail_server' => array('mail_server', t('IMAP server name:'), $mail_server, ''), '$mail_port' => array('mail_port', t('IMAP port:'), $mail_port, ''), - '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array( ''=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL')), + '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array( 'notls'=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL')), '$mail_user' => array('mail_user', t('Email login name:'), $mail_user, ''), '$mail_pass' => array('mail_pass', t('Email password:'), '', ''), '$mail_replyto' => array('mail_replyto', t('Reply-to address:'), '', 'Optional'), -- cgit v1.2.3 From 7956c2d08e209635c40ca62e2a37d46fd41869af Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 Mar 2012 17:21:56 -0700 Subject: improved rw notifications --- mod/dfrn_notify.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 71860ac3b..8e4ce0671 100755 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -158,6 +158,7 @@ function dfrn_notify_post(&$a) { ); } + logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']); logger('dfrn_notify: data: ' . $data, LOGGER_DATA); @@ -174,6 +175,13 @@ function dfrn_notify_post(&$a) { } + + // If we are setup as a soapbox we aren't accepting input from this person + + if($importer['page-flags'] == PAGE_SOAPBOX) + xml_status(0); + + if(strlen($key)) { $rawkey = hex2bin(trim($key)); logger('rino: md5 raw key: ' . md5($rawkey)); @@ -261,7 +269,7 @@ function dfrn_notify_content(&$a) { break; // NOTREACHED } - $r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` + $r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`page-flags` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `user`.`nickname` = '%s' AND `user`.`account_expired` = 0 $sql_extra LIMIT 1", dbesc($a->argv[1]) @@ -299,6 +307,12 @@ function dfrn_notify_content(&$a) { if(! $rino_enable) $rino = 0; + if((($r[0]['rel']) && ($r[0]['rel'] != CONTACT_IS_SHARING)) || ($r[0]['page-flags'] == PAGE_COMMUNITY)) { + $perm = 'rw'; + } + else { + $perm = 'r'; + } header("Content-type: text/xml"); @@ -306,7 +320,8 @@ function dfrn_notify_content(&$a) { . '' . "\r\n" . "\t" . '' . $status . '' . "\r\n" . "\t" . '' . DFRN_PROTOCOL_VERSION . '' . "\r\n" - . "\t" . '' . $rino . '' . "\r\n" + . "\t" . '' . $rino . '' . "\r\n" + . "\t" . '' . $perm . '' . "\r\n" . "\t" . '' . $encrypted_id . '' . "\r\n" . "\t" . '' . $challenge . '' . "\r\n" . '' . "\r\n" ; -- cgit v1.2.3 From 77715c0c65b5275f1d1b4b1c4b79bcf62b417c51 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 Mar 2012 17:44:24 -0700 Subject: fix notification total --- mod/ping.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index 1562254b1..23a3f4937 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -22,6 +22,7 @@ function ping_init(&$a) { and seen = 0 order by date desc limit 0, 50", intval(local_user()) ); + $sysnotify = $r[0]['total']; } else { $z1 = q("select * from notify where uid = %d @@ -35,6 +36,7 @@ function ping_init(&$a) { intval(50 - intval($t[0]['total'])) ); $z = array_merge($z1,$z2); + $sysnotify = 0; // we will update this in a moment } @@ -147,13 +149,12 @@ function ping_init(&$a) { $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags); require_once('include/bbcode.php'); - $sysnotify = 0; if($firehose) { echo ' '; } else { - if(count($z)) { + if(count($z) && (! $sysnotify)) { foreach($z as $zz) { if($zz['seen'] == 0) $sysnotify ++; -- cgit v1.2.3 From 3f89adfd62dc433bf75d193b84d4cfb47de3358b Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 Mar 2012 17:51:43 -0700 Subject: wrong var for notify total --- mod/ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index 23a3f4937..e911aaf1f 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -22,7 +22,7 @@ function ping_init(&$a) { and seen = 0 order by date desc limit 0, 50", intval(local_user()) ); - $sysnotify = $r[0]['total']; + $sysnotify = $t[0]['total']; } else { $z1 = q("select * from notify where uid = %d -- cgit v1.2.3 From 75f778a504c6032c6e029c741be8354419130741 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 Mar 2012 18:22:20 -0700 Subject: provide a way to specify an admin account for siteinfo if more than one have admin email address --- mod/friendica.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/friendica.php b/mod/friendica.php index d5dad9448..52a064224 100755 --- a/mod/friendica.php +++ b/mod/friendica.php @@ -4,8 +4,12 @@ function friendica_init(&$a) { if ($a->argv[1]=="json"){ $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); + $sql_extra = ''; + if(x($a->config,'admin_nickname')) { + $sql_extra = sprintf(" AND nickname = '%s' ",dbesc($a->config['admin_nickname'])); + } if (isset($a->config['admin_email']) && $a->config['admin_email']!=''){ - $r = q("SELECT username, nickname FROM user WHERE email='%s'", $a->config['admin_email']); + $r = q("SELECT username, nickname FROM user WHERE email='%s' $sql_extra", dbesc($a->config['admin_email'])); $admin = array( 'name' => $r[0]['username'], 'profile'=> $a->get_baseurl().'/profile/'.$r[0]['nickname'], -- cgit v1.2.3 From bb8beb26b4d87c27ce4c8dce3e1229a27a2d1a7e Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 Mar 2012 20:58:32 -0700 Subject: use zrl to get home again --- mod/viewcontacts.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod') diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 6b66f60d7..e7d26b73e 100755 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -54,6 +54,8 @@ function viewcontacts_content(&$a) { if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) $url = 'redir/' . $rr['id']; + else + $url = zrl($url); $contacts[] = array( 'id' => $rr['id'], -- cgit v1.2.3 From d83bfd464baebf7d203a07d1bd92a00d2734d0ad Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 Mar 2012 22:20:14 -0700 Subject: zrl into people searches --- mod/dirfind.php | 2 +- mod/match.php | 2 +- mod/notifications.php | 4 ++-- mod/suggest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'mod') diff --git a/mod/dirfind.php b/mod/dirfind.php index 75b1c4976..34c54dd91 100755 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -46,7 +46,7 @@ function dirfind_content(&$a) { foreach($j->results as $jj) { $o .= replace_macros($tpl,array( - '$url' => $jj->url, + '$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$tags' => $jj->tags diff --git a/mod/match.php b/mod/match.php index 1ae7848a6..926df1dff 100755 --- a/mod/match.php +++ b/mod/match.php @@ -51,7 +51,7 @@ function match_content(&$a) { $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url; $o .= replace_macros($tpl,array( - '$url' => $jj->url, + '$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$inttxt' => ' ' . t('is interested in:'), diff --git a/mod/notifications.php b/mod/notifications.php index ff131010f..551b307db 100755 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -145,7 +145,7 @@ function notifications_content(&$a) { '$contact_id' => $rr['contact-id'], '$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"), '$fullname' => $rr['fname'], - '$url' => $rr['furl'], + '$url' => zrl($rr['furl']), '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')), @@ -195,7 +195,7 @@ function notifications_content(&$a) { '$fullname' => $rr['name'], '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')), - '$url' => $rr['url'], + '$url' => zrl($rr['url']), '$knowyou' => $knowyou, '$approve' => t('Approve'), '$note' => $rr['note'], diff --git a/mod/suggest.php b/mod/suggest.php index b8ca423c5..7a86d53a1 100755 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -52,7 +52,7 @@ function suggest_content(&$a) { $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $o .= replace_macros($tpl,array( - '$url' => $rr['url'], + '$url' => zrl($rr['url']), '$name' => $rr['name'], '$photo' => $rr['photo'], '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], -- cgit v1.2.3 From bcc58016089c5e5c0e1e5e247d9253b4ac664c2c Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 30 Mar 2012 02:42:36 -0700 Subject: rename "file as" to "save to folder" --- mod/filer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/filer.php b/mod/filer.php index 82537848b..3b3a37931 100755 --- a/mod/filer.php +++ b/mod/filer.php @@ -25,7 +25,7 @@ function filer_content(&$a) { $filetags = explode("][", trim($filetags,"[]")); $tpl = get_markup_template("filer_dialog.tpl"); $o = replace_macros($tpl, array( - '$field' => array('term', t("File as:"), '', '', $filetags, t('- select -')), + '$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')), '$submit' => t('Save'), )); -- cgit v1.2.3 From 054d21a2e8142de1edfc1afb5d3d8dba33f83960 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 30 Mar 2012 15:45:02 +0200 Subject: settings: add "display settings" tab, with UI-related settings. Load optional "config.php" from theme folder and show in page. Loading of "config.php" follow theme_info['extends'] property. --- mod/settings.php | 229 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 156 insertions(+), 73 deletions(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index db7330fb5..ce5ceea82 100755 --- a/mod/settings.php +++ b/mod/settings.php @@ -1,6 +1,19 @@ theme_info['extends']; + + if (file_exists("view/theme/$theme/config.php")){ + return "view/theme/$theme/config.php"; + } + if (file_exists("view/theme/$base_theme/config.php")){ + return "view/theme/$base_theme/config.php"; + } + return null; +} + function settings_init(&$a) { if(local_user()) { profile_load($a,$a->user['nickname']); @@ -193,6 +206,45 @@ function settings_post(&$a) { call_hooks('connector_settings_post', $_POST); return; } + + if(($a->argc > 1) && ($a->argv[1] == 'display')) { + + check_form_security_token_redirectOnErr('/settings/display', 'settings_display'); + + $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']); + $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); + $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); + $browser_update = $browser_update * 1000; + if($browser_update < 10000) + $browser_update = 40000; + + $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40); + if($itemspage_network > 100) + $itemspage_network = 40; + + + set_pconfig(local_user(),'system','update_interval', $browser_update); + set_pconfig(local_user(),'system','itemspage_network', $itemspage_network); + set_pconfig(local_user(),'system','no_smilies',$nosmile); + + + if ($theme == $a->user['theme']){ + // call theme_post only if theme has not benn changed + if( ($themeconfigfile = get_theme_config_file($theme)) != null){ + require_once($themeconfigfile); + theme_post($a); + } + } + + + $r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d LIMIT 1", + dbesc($theme), + intval(local_user()) + ); + + goaway($a->get_baseurl(true) . '/settings/display' ); + return; // NOTREACHED + } check_form_security_token_redirectOnErr('/settings', 'settings'); @@ -227,7 +279,7 @@ function settings_post(&$a) { } } - $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']); + $username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : ''); $email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : ''); $timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : ''); @@ -242,14 +294,6 @@ function settings_post(&$a) { $expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0); $expire_photos = ((x($_POST,'expire_photos'))? intval($_POST['expire_photos']) : 0); - $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); - $browser_update = $browser_update * 1000; - if($browser_update < 10000) - $browser_update = 40000; - - $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40); - if($itemspage_network > 100) - $itemspage_network = 40; $allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0); @@ -263,7 +307,7 @@ function settings_post(&$a) { $suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); - $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); + $notify = 0; @@ -345,11 +389,9 @@ function settings_post(&$a) { set_pconfig(local_user(),'expire','photos', $expire_photos); set_pconfig(local_user(),'system','suggestme', $suggestme); - set_pconfig(local_user(),'system','update_interval', $browser_update); - set_pconfig(local_user(),'system','itemspage_network', $itemspage_network); - set_pconfig(local_user(),'system','no_smilies',$nosmile); - $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d WHERE `uid` = %d LIMIT 1", + + $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d WHERE `uid` = %d LIMIT 1", dbesc($username), dbesc($email), dbesc($openid), @@ -362,7 +404,6 @@ function settings_post(&$a) { intval($page_flags), dbesc($defloc), intval($allow_location), - dbesc($theme), intval($maxreq), intval($expire), dbesc($openidserver), @@ -440,6 +481,12 @@ function settings_content(&$a) { 'url' => $a->get_baseurl(true).'/settings', 'sel' => (($a->argc == 1)?'active':''), ), + array( + 'label' => t('Display settings'), + 'url' => $a->get_baseurl(true).'/settings/display', + 'sel' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''), + ), + array( 'label' => t('Connector settings'), 'url' => $a->get_baseurl(true).'/settings/connectors', @@ -578,31 +625,31 @@ function settings_content(&$a) { $diasp_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('Diaspora'), ((get_config('system','diaspora_enabled')) ? t('enabled') : t('disabled'))); $ostat_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('StatusNet'), ((get_config('system','ostatus_disabled')) ? t('disabled') : t('enabled'))); - $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); - if(get_config('system','dfrn_only')) - $mail_disabled = 1; + $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); + if(get_config('system','dfrn_only')) + $mail_disabled = 1; - if(! $mail_disabled) { - $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", - local_user() - ); - } - else { - $r = null; - } + if(! $mail_disabled) { + $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", + local_user() + ); + } + else { + $r = null; + } - $mail_server = ((count($r)) ? $r[0]['server'] : ''); - $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : ''); - $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : ''); - $mail_user = ((count($r)) ? $r[0]['user'] : ''); - $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : ''); - $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0); - $mail_action = ((count($r)) ? $r[0]['action'] : 0); - $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : ''); - $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00'); + $mail_server = ((count($r)) ? $r[0]['server'] : ''); + $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : ''); + $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : ''); + $mail_user = ((count($r)) ? $r[0]['user'] : ''); + $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : ''); + $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0); + $mail_action = ((count($r)) ? $r[0]['action'] : 0); + $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : ''); + $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00'); - $tpl = get_markup_template("settings_connectors.tpl"); + $tpl = get_markup_template("settings_connectors.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_connectors"), @@ -632,6 +679,78 @@ function settings_content(&$a) { return $o; } + /* + * DISPLAY SETTINGS + */ + if(($a->argc > 1) && ($a->argv[1] === 'display')) { + $default_theme = get_config('system','theme'); + if(! $default_theme) + $default_theme = 'default'; + + $allowed_themes_str = get_config('system','allowed_themes'); + $allowed_themes_raw = explode(',',$allowed_themes_str); + $allowed_themes = array(); + if(count($allowed_themes_raw)) + foreach($allowed_themes_raw as $x) + if(strlen(trim($x))) + $allowed_themes[] = trim($x); + + + $themes = array(); + $files = glob('view/theme/*'); + if($allowed_themes) { + foreach($allowed_themes as $th) { + $f = $th; + $is_experimental = file_exists('view/theme/' . $th . '/experimental'); + $unsupported = file_exists('view/theme/' . $th . '/unsupported'); + if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ + $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f); + $themes[$f]=$theme_name; + } + } + } + $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']); + + $browser_update = intval(get_pconfig(local_user(), 'system','update_interval')); + $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds + + $itemspage_network = intval(get_pconfig(local_user(), 'system','itemspage_network')); + $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items + + $nosmile = get_pconfig(local_user(),'system','no_smilies'); + $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0 + + + $theme_config = ""; + if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){ + require_once($themeconfigfile); + $theme_config = theme_content($a); + } + + $tpl = get_markup_template("settings_display.tpl"); + $o = replace_macros($tpl, array( + '$tabs' => $tabs, + '$ptitle' => t('Display Settings'), + '$form_security_token' => get_form_security_token("settings_display"), + '$submit' => t('Submit'), + '$baseurl' => $a->get_baseurl(true), + '$uid' => local_user(), + + '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes), + '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), + '$itemspage_network' => array('itemspage_network', t("Number of items to display on the network page:"), $itemspage_network, t('Maximum of 100 items')), + '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), + + '$theme_config' => $theme_config, + )); + + return $o; + } + + + /* + * ACCOUNT SETTINGS + */ require_once('include/acl_selectors.php'); @@ -669,14 +788,7 @@ function settings_content(&$a) { $suggestme = get_pconfig(local_user(), 'system','suggestme'); $suggestme = (($suggestme===false)? '0': $suggestme); // default if not set: 0 - $browser_update = intval(get_pconfig(local_user(), 'system','update_interval')); - $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds - $itemspage_network = intval(get_pconfig(local_user(), 'system','itemspage_network')); - $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items - - $nosmile = get_pconfig(local_user(),'system','no_smilies'); - $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0 if(! strlen($a->user['timezone'])) $timezone = date_default_timezone_get(); @@ -765,33 +877,7 @@ function settings_content(&$a) { info( t('Profile is not published.') . EOL ); - $default_theme = get_config('system','theme'); - if(! $default_theme) - $default_theme = 'default'; - - $allowed_themes_str = get_config('system','allowed_themes'); - $allowed_themes_raw = explode(',',$allowed_themes_str); - $allowed_themes = array(); - if(count($allowed_themes_raw)) - foreach($allowed_themes_raw as $x) - if(strlen(trim($x))) - $allowed_themes[] = trim($x); - - $themes = array(); - $files = glob('view/theme/*'); - if($allowed_themes) { - foreach($allowed_themes as $th) { - $f = $th; - $is_experimental = file_exists('view/theme/' . $th . '/experimental'); - $unsupported = file_exists('view/theme/' . $th . '/unsupported'); - if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ - $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f); - $themes[$f]=$theme_name; - } - } - } - $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']); $subdir = ((strlen($a->get_path())) ? '
' . t('or') . ' ' . $a->get_baseurl(true) . '/profile/' . $nickname : ''); @@ -842,10 +928,7 @@ function settings_content(&$a) { '$timezone' => array('timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''), '$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''), '$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''), - '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes), - '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), - '$itemspage_network' => array('itemspage_network', t("Number of items to display on the network page:"), $itemspage_network, t('Maximum of 100 items')), - '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), + '$h_prv' => t('Security and Privacy Settings'), -- cgit v1.2.3 From 01af7d355a0dfdf19db7acf3b5b06b683c58531e Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 30 Mar 2012 21:18:25 +0200 Subject: allow themes to use "style.php" instead of "style.css". Load style.php trhu mod/view.php to pass it friendica framework. --- mod/view.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 mod/view.php (limited to 'mod') diff --git a/mod/view.php b/mod/view.php new file mode 100644 index 000000000..33aa23f44 --- /dev/null +++ b/mod/view.php @@ -0,0 +1,16 @@ +argc == 4){ + $theme = $a->argv[2]; + $THEMEPATH = "view/theme/$theme"; + require_once("view/theme/$theme/style.php"); + } + + killme(); +} -- cgit v1.2.3 From cfdfcb37cbed8354e9f6c025a6e9ccadafc2d625 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 30 Mar 2012 15:10:50 -0700 Subject: don't delete contact from a friend request if friendship was already established --- mod/notifications.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/notifications.php b/mod/notifications.php index 551b307db..690a99562 100755 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -37,7 +37,11 @@ function notifications_post(&$a) { intval($intro_id) ); if(! $fid) { - $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 LIMIT 1", + + // The check for blocked and pending is in case the friendship was already approved + // and we just want to get rid of the now pointless notification + + $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 AND `blocked` = 1 AND `pending` = 1 LIMIT 1", intval($contact_id), intval(local_user()) ); -- cgit v1.2.3 From 8c928e67ba9f122343f53400cf0f4dae8104ffd7 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 30 Mar 2012 23:18:46 -0700 Subject: warning cleanup --- mod/search.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/search.php b/mod/search.php index 50e7a6abc..6495fc8e5 100755 --- a/mod/search.php +++ b/mod/search.php @@ -97,19 +97,16 @@ function search_content(&$a) { // OR your own posts if you are a logged in member // No items will be shown if the member has a blocked profile wall. - $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", - dbesc(preg_quote($search)), dbesc('\\]' . preg_quote($search) . '\\[')); - - $search_alg = $s_regx; - $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0) OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - $search_alg ", - intval(local_user()) + AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", + intval(local_user()), + dbesc(preg_quote($search)), + dbesc('\\]' . preg_quote($search) . '\\[') ); if(count($r)) @@ -131,9 +128,11 @@ function search_content(&$a) { AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0 ) OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - $search_alg + AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) ORDER BY `received` DESC LIMIT %d , %d ", intval(local_user()), + dbesc(preg_quote($search)), + dbesc('\\]' . preg_quote($search) . '\\['), intval($a->pager['start']), intval($a->pager['itemspage']) -- cgit v1.2.3 From b4b1055b502c317513bf5c57794c004ced43a0de Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 31 Mar 2012 00:57:59 -0700 Subject: settings for unknown private mail acceptance --- mod/settings.php | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index ce5ceea82..ce2d64851 100755 --- a/mod/settings.php +++ b/mod/settings.php @@ -303,7 +303,8 @@ function settings_post(&$a) { $page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); $blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted! $blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted! - + $unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0); + $cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0); $suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); @@ -391,7 +392,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','suggestme', $suggestme); - $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d WHERE `uid` = %d LIMIT 1", + $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d, `unkmail` = %d, `cntunkmail` = %d WHERE `uid` = %d LIMIT 1", dbesc($username), dbesc($email), dbesc($openid), @@ -410,6 +411,8 @@ function settings_post(&$a) { intval($blockwall), intval($hidewall), intval($blocktags), + intval($unkmail), + intval($cntunkmail), intval(local_user()) ); if($r) @@ -760,17 +763,19 @@ function settings_content(&$a) { if(count($p)) $profile = $p[0]; - $username = $a->user['username']; - $email = $a->user['email']; - $nickname = $a->user['nickname']; - $timezone = $a->user['timezone']; - $notify = $a->user['notify-flags']; - $defloc = $a->user['default-location']; - $openid = $a->user['openid']; - $maxreq = $a->user['maxreq']; - $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : ''); - $blockwall = $a->user['blockwall']; - $blocktags = $a->user['blocktags']; + $username = $a->user['username']; + $email = $a->user['email']; + $nickname = $a->user['nickname']; + $timezone = $a->user['timezone']; + $notify = $a->user['notify-flags']; + $defloc = $a->user['default-location']; + $openid = $a->user['openid']; + $maxreq = $a->user['maxreq']; + $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : ''); + $blockwall = $a->user['blockwall']; + $blocktags = $a->user['blocktags']; + $unkmail = $a->user['unkmail']; + $cntunkmail = $a->user['cntunkmail']; $expire_items = get_pconfig(local_user(), 'expire','items'); $expire_items = (($expire_items===false)? '1' : $expire_items); // default if not set: 1 @@ -870,6 +875,12 @@ function settings_content(&$a) { )); + $unkmail = replace_macros($opt_tpl,array( + '$field' => array('unkmail', t('Permit unknown people to send you private messages?'), $unkmail, '', array(t('No'),t('Yes'))), + + )); + + $invisible = (((! $profile['publish']) && (! $profile['net-publish'])) ? true : false); @@ -946,7 +957,8 @@ function settings_content(&$a) { '$profile_in_net_dir' => $profile_in_net_dir, '$hide_friends' => $hide_friends, '$hide_wall' => $hide_wall, - + '$unkmail' => $unkmail, + '$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), $cntunkmail ,t("\x28to prevent spam abuse\x29")), '$h_not' => t('Notification Settings'), -- cgit v1.2.3 From adebc2793e84344fca1700eb6af583a9a0abcb1a Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 31 Mar 2012 06:15:33 -0700 Subject: register hooks for a COPA plugin --- mod/register.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mod') diff --git a/mod/register.php b/mod/register.php index 6d0e2700b..91080b1d8 100755 --- a/mod/register.php +++ b/mod/register.php @@ -8,6 +8,8 @@ function register_post(&$a) { $verified = 0; $blocked = 1; + $arr = array('post' => $_POST); + call_hooks('register_post', $arr); $max_dailies = intval(get_config('system','max_daily_registrations')); if($max_dailes) { @@ -540,6 +542,11 @@ function register_content(&$a) { $license = ''; $o = get_markup_template("register.tpl"); + + $arr = array('template' => $o); + + call_hooks('register_form',$arr); + $o = replace_macros($o, array( '$oidhtml' => $oidhtml, '$invitations' => get_config('system','invitation_only'), -- cgit v1.2.3 From 53f799f2bc125fadf527e3c65e8e9882d53d9aea Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 31 Mar 2012 15:25:17 -0700 Subject: handle escaped file chars in display and search --- mod/filer.php | 4 ++-- mod/filerm.php | 4 ++-- mod/network.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'mod') diff --git a/mod/filer.php b/mod/filer.php index 3b3a37931..3cd1bfe22 100755 --- a/mod/filer.php +++ b/mod/filer.php @@ -11,8 +11,8 @@ function filer_content(&$a) { killme(); } - $term = notags(trim($_GET['term'])); - $item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0); + $term = unxmlify(trim($_GET['term'])); + $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); logger('filer: tag ' . $term . ' item ' . $item_id); diff --git a/mod/filerm.php b/mod/filerm.php index 66b684dc9..c520fec7a 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -6,8 +6,8 @@ function filerm_content(&$a) { killme(); } - $term = notags(trim($_GET['term'])); - $item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0); + $term = unxmlify(trim($_GET['term'])); + $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); logger('filerm: tag ' . $term . ' item ' . $item_id); diff --git a/mod/network.php b/mod/network.php index 5ca0a8c7d..d27945a86 100755 --- a/mod/network.php +++ b/mod/network.php @@ -393,7 +393,7 @@ function network_content(&$a, $update = 0) { ); } if(strlen($file)) { - $sql_extra .= file_tag_file_query('item',$file); + $sql_extra .= file_tag_file_query('item',unxmlify($file)); } if($conv) { -- cgit v1.2.3 From 2147e0a71fab98fd6e11b1ca54e46821c8829213 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 31 Mar 2012 16:08:40 -0700 Subject: ensure all new users get a timezone. We'll use UTC until they choose otherwise. --- mod/register.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/register.php b/mod/register.php index 91080b1d8..630c0a675 100755 --- a/mod/register.php +++ b/mod/register.php @@ -220,8 +220,8 @@ function register_post(&$a) { $spubkey = $spkey["key"]; $r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`, - `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked` ) - VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )", + `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone` ) + VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC' )", dbesc(generate_user_guid()), dbesc($username), dbesc($new_password_encoded), -- cgit v1.2.3 From ea10bba14711d26dfbefcd83659bb60ae6587e26 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 31 Mar 2012 20:08:32 -0700 Subject: fix "between yourself and You" in mail list --- mod/message.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/message.php b/mod/message.php index 949e5616c..c347468d1 100755 --- a/mod/message.php +++ b/mod/message.php @@ -192,15 +192,12 @@ function message_content(&$a) { return $o; } - if(($a->argc == 1) || ($a->argc == 2 && $a->argv[1] === 'sent')) { + if($a->argc == 1) { + + // list messages $o .= $header; - if($a->argc == 2) - $eq = sprintf( "AND `from-url` = '%s'", dbesc($myprofile)); - else - $eq = ''; - $r = q("SELECT count(*) AS `total` FROM `mail` WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `created` DESC", intval(local_user()), @@ -213,7 +210,7 @@ function message_content(&$a) { `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`, count( * ) as count FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` - WHERE `mail`.`uid` = %d $eq GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", + WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", intval(local_user()), // intval($a->pager['start']), @@ -226,7 +223,7 @@ function message_content(&$a) { $tpl = get_markup_template('mail_list.tpl'); foreach($r as $rr) { - if ($rr['from-url'] == $myprofile){ + if (link_compare($rr['from-url'],$myprofile)){ $partecipants = sprintf( t("You and %s"), $rr['name']); } else { $partecipants = sprintf( t("%s and You"), $rr['from-name']); -- cgit v1.2.3 From 5c2fdc795fc5273176a7f81d989ad06e16945f1c Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 1 Apr 2012 00:59:35 -0700 Subject: send unverified private mail using zrl --- mod/message.php | 19 +++++-- mod/settings.php | 2 +- mod/wallmessage.php | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 mod/wallmessage.php (limited to 'mod') diff --git a/mod/message.php b/mod/message.php index c347468d1..1369fde2e 100755 --- a/mod/message.php +++ b/mod/message.php @@ -223,9 +223,13 @@ function message_content(&$a) { $tpl = get_markup_template('mail_list.tpl'); foreach($r as $rr) { - if (link_compare($rr['from-url'],$myprofile)){ + if($rr['unknown']) { + $partecipants = sprintf( t("Unknown sender - %s"),$rr['from-name']); + } + elseif (link_compare($rr['from-url'],$myprofile)){ $partecipants = sprintf( t("You and %s"), $rr['name']); - } else { + } + else { $partecipants = sprintf( t("%s and You"), $rr['from-name']); } @@ -234,7 +238,7 @@ function message_content(&$a) { '$from_name' => $partecipants, '$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']), '$sparkle' => ' sparkle', - '$from_photo' => $rr['thumb'], + '$from_photo' => (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']), '$subject' => template_escape((($rr['mailseen']) ? $rr['title'] : '' . $rr['title'] . '')), '$delete' => t('Delete conversation'), '$body' => template_escape($rr['body']), @@ -297,7 +301,11 @@ function message_content(&$a) { $mails = array(); $seen = 0; + $unknown = false; + foreach($messages as $message) { + if($message['unknown']) + $unknown = true; if($message['from-url'] == $myprofile) { $from_url = $myprofile; $sparkle = ''; @@ -323,7 +331,7 @@ function message_content(&$a) { } $select = $message['name'] . ''; $parent = ''; - + $tpl = get_markup_template('mail_display.tpl'); $o = replace_macros($tpl, array( @@ -331,7 +339,8 @@ function message_content(&$a) { '$thread_subject' => $message['title'], '$thread_seen' => $seen, '$delete' => t('Delete conversation'), - + '$canreply' => (($unknown) ? false : '1'), + '$unknown_text' => t("No secure communications available. You may be able to respond from the sender's profile page."), '$mails' => $mails, // reply diff --git a/mod/settings.php b/mod/settings.php index ce2d64851..926d1faa5 100755 --- a/mod/settings.php +++ b/mod/settings.php @@ -876,7 +876,7 @@ function settings_content(&$a) { $unkmail = replace_macros($opt_tpl,array( - '$field' => array('unkmail', t('Permit unknown people to send you private messages?'), $unkmail, '', array(t('No'),t('Yes'))), + '$field' => array('unkmail', t('Permit unknown people to send you private mail?'), $unkmail, '', array(t('No'),t('Yes'))), )); diff --git a/mod/wallmessage.php b/mod/wallmessage.php new file mode 100644 index 000000000..1a4882b64 --- /dev/null +++ b/mod/wallmessage.php @@ -0,0 +1,149 @@ +argc > 1) ? notags($a->argv[1]) : ''); + if((! $recipient) || (! $body)) { + return; + } + + $r = q("select * from user where nickname = '%s' limit 1", + dbesc($recipient) + ); + + if(! count($r)) { + logger('wallmessage: no recipient'); + return; + } + + $user = $r[0]; + + if(! intval($user['unkmail'])) { + notice( t('Permission denied.') . EOL); + return; + } + + $r = q("select count(*) as total from mail where uid = %d and created > UTC_TIMESTAMP() - INTERVAL 1 day and unknown = 1", + intval($user['uid']) + ); + + if($r[0]['total'] > $user['cntunkmail']) { + notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']))); + return; + } + + // Work around doubled linefeeds in Tinymce 3.5b2 +dbg(1); + $body = str_replace("\r\n","\n",$body); + $body = str_replace("\n\n","\n",$body); + + + $ret = send_wallmessage($user, $body, $subject, $replyto); + + switch($ret){ + case -1: + notice( t('No recipient selected.') . EOL ); + break; + case -2: + notice( t('Unable to check your home location.') . EOL ); + break; + case -3: + notice( t('Message could not be sent.') . EOL ); + break; + case -4: + notice( t('Message collection failure.') . EOL ); + break; + default: + info( t('Message sent.') . EOL ); + } +dbg(0); +// goaway($a->get_baseurl() . '/profile/' . $user['nickname']); + +} + + +function wallmessage_content(&$a) { + + if(! get_my_url()) { + notice( t('Permission denied.') . EOL); + return; + } + + $recipient = (($a->argc > 1) ? $a->argv[1] : ''); + + if(! $recipient) { + notice( t('No recipient.') . EOL); + return; + } + + $r = q("select * from user where nickname = '%s' limit 1", + dbesc($recipient) + ); + + if(! count($r)) { + notice( t('No recipient.') . EOL); + logger('wallmessage: no recipient'); + return; + } + + $user = $r[0]; + + if(! intval($user['unkmail'])) { + notice( t('Permission denied.') . EOL); + return; + } + + $r = q("select count(*) as total from mail where uid = %d and created > UTC_TIMESTAMP() - INTERVAL 1 day and unknown = 1", + intval($user['uid']) + ); + + if($r[0]['total'] > $user['cntunkmail']) { + notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']))); + return; + } + + + + $tpl = get_markup_template('wallmsg-header.tpl'); + + $a->page['htmlhead'] .= replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(true), + '$editselect' => '/(profile-jot-text|prvmail-text)/', + '$nickname' => $user['nickname'], + '$linkurl' => t('Please enter a link URL:') + )); + + + + $tpl = get_markup_template('wallmessage.tpl'); + $o .= replace_macros($tpl,array( + '$header' => t('Send Private Message'), + '$subheader' => sprintf( t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.'), $user['username']), + '$to' => t('To:'), + '$subject' => t('Subject:'), + '$recipname' => $user['username'], + '$nickname' => $user['nickname'], + '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''), + '$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''), + '$readonly' => '', + '$yourmessage' => t('Your message:'), + '$select' => $select, + '$parent' => '', + '$upload' => t('Upload photo'), + '$insert' => t('Insert web link'), + '$wait' => t('Please wait') + )); + + return $o; + } -- cgit v1.2.3