From 3174847de80600be5e0bf32864edca79388d6433 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 10 Oct 2011 01:03:34 -0700 Subject: bug #177 - birthday month on profile incorrect if October or later and no year --- include/profile_advanced.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/profile_advanced.php b/include/profile_advanced.php index 22e035fe6..41ad322b2 100644 --- a/include/profile_advanced.php +++ b/include/profile_advanced.php @@ -48,7 +48,7 @@ $short_bd_format = t('j F'); $o .= '
' . ((intval($a->profile['dob'])) ? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format)) - : day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],6) . ' 00:00 +00:00',$short_bd_format))) + : day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],5) . ' 00:00 +00:00',$short_bd_format))) . "
\r\n"; $o .= '
'; -- cgit v1.2.3 From 06c268b3db815d56a92bfabd8df297f5e4331689 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 10 Oct 2011 12:56:15 -0700 Subject: revup --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index c8ec84681..3da6d2c33 100644 --- a/boot.php +++ b/boot.php @@ -8,7 +8,7 @@ require_once("include/pgettext.php"); require_once('include/nav.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); -define ( 'FRIENDIKA_VERSION', '2.3.1129' ); +define ( 'FRIENDIKA_VERSION', '2.3.1130' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1094 ); -- cgit v1.2.3 From 557a7d0cec31a36d12898429c479c71671833dfd Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 11 Oct 2011 18:24:37 -0700 Subject: stuff - background the external network notifications (Facebook, Twitter, Statusnet) - add vimeo support - consolidate editor video options (insert video, regardless of source) - add "Connector Settings" page purely for configuring connectors - moved mailbox settings to Connectors - Move the "Connect/Follow" dialogue out of "find people" and move to top. - Add "Find People" dialogue - minor theme edits on duepuntozero and testbubble to make all this stuff work - A bit of theming on duepunto notifications to eliminate the gigantic Diaspora profile photos. --- boot.php | 4 +- database.sql | 1 + include/api.php | 6 +- include/bbcode.php | 3 + include/conversation.php | 10 +- include/items.php | 19 +-- include/notifier.php | 6 + include/text.php | 34 ++++++ mod/contacts.php | 33 +++--- mod/dirfind.php | 52 +++++++++ mod/item.php | 10 +- mod/match.php | 1 + mod/ping.php | 8 +- mod/settings.php | 239 ++++++++++++++++++++++---------------- mod/tagmatch.php | 52 --------- update.php | 8 +- view/contacts-top.tpl | 1 + view/follow.tpl | 5 +- view/jot-header.tpl | 7 -- view/jot.tpl | 3 - view/peoplefind.tpl | 12 ++ view/settings.tpl | 24 ---- view/settings_addons.tpl | 2 +- view/settings_connectors.tpl | 34 ++++++ view/theme/duepuntozero/style.css | 24 +++- view/theme/testbubble/style.css | 21 +++- 26 files changed, 374 insertions(+), 245 deletions(-) create mode 100644 mod/dirfind.php delete mode 100644 mod/tagmatch.php create mode 100644 view/peoplefind.tpl create mode 100644 view/settings_connectors.tpl diff --git a/boot.php b/boot.php index 140ef095a..f483d32f3 100644 --- a/boot.php +++ b/boot.php @@ -8,9 +8,9 @@ require_once("include/pgettext.php"); require_once('include/nav.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); -define ( 'FRIENDIKA_VERSION', '2.3.1130' ); +define ( 'FRIENDIKA_VERSION', '2.3.1131' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1094 ); +define ( 'DB_UPDATE_VERSION', 1095 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 15e2f2cca..ed92aa4c1 100644 --- a/database.sql +++ b/database.sql @@ -193,6 +193,7 @@ CREATE TABLE IF NOT EXISTS `item` ( `object` text NOT NULL, `target-type` char(255) NOT NULL, `target` text NOT NULL, + `postopts` text NOT NULL, `plink` char(255) NOT NULL, `resource-id` char(255) NOT NULL, `event-id` int(10) unsigned NOT NULL, diff --git a/include/api.php b/include/api.php index 74b4aaf6e..1334d8eae 100644 --- a/include/api.php +++ b/include/api.php @@ -483,11 +483,7 @@ $txt = requestdata('htmlstatus'); if((strpos($txt,'<') !== false) || (strpos($txt,'>') !== false)) { - $txt = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', - '[youtube]$1[/youtube]', $txt); - - $txt = preg_replace('#].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?#s', - '[youtube]$1[/youtube]', $txt); + $txt = html2bb_video($txt); $config = HTMLPurifier_Config::createDefault(); $config->set('Cache.DefinitionImpl', null); diff --git a/include/bbcode.php b/include/bbcode.php index 9abc7c439..b33be686e 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -141,6 +141,9 @@ function bbcode($Text,$preserve_nl = false) { $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '', $Text); } + $Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text); + $Text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text); + $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '', $Text); // $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '', $Text); diff --git a/include/conversation.php b/include/conversation.php index 18f6d080b..29fa77902 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -745,9 +745,8 @@ function status_editor($a,$x, $notes_cid = 0) { '$nickname' => $x['nickname'], '$ispublic' => t('Visible to everybody'), '$linkurl' => t('Please enter a link URL:'), - '$utubeurl' => t('Please enter a YouTube link:'), - '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"), - '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"), + '$vidurl' => t("Please enter a video link/URL:"), + '$audurl' => t("Please enter an audio link/URL:"), '$whereareu' => t('Where are you right now?'), '$title' => t('Enter a title for this item') )); @@ -795,9 +794,8 @@ function status_editor($a,$x, $notes_cid = 0) { '$upload' => t('Upload photo'), '$attach' => t('Attach file'), '$weblink' => t('Insert web link'), - '$youtube' => t('Insert YouTube video'), - '$video' => t('Insert Vorbis [.ogg] video'), - '$audio' => t('Insert Vorbis [.ogg] audio'), + '$video' => t('Insert video link'), + '$audio' => t('Insert audio link'), '$setloc' => t('Set your location'), '$noloc' => t('Clear browser location'), '$title' => t('Set title'), diff --git a/include/items.php b/include/items.php index 8360a42ec..4862ca578 100644 --- a/include/items.php +++ b/include/items.php @@ -414,11 +414,7 @@ function get_atom_elements($feed,$item) { if((strpos($res['body'],'<') !== false) || (strpos($res['body'],'>') !== false)) { - $res['body'] = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', - '[youtube]$1[/youtube]', $res['body']); - - $res['body'] = preg_replace('#].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?#s', - '[youtube]$1[/youtube]', $res['body']); + $res['body'] = html2bb_video($res['body']); $res['body'] = oembed_html2bbcode($res['body']); @@ -586,12 +582,7 @@ function get_atom_elements($feed,$item) { $res['object'] .= '' . xmlify($body) . '' . "\n"; if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) { - $body = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', - '[youtube]$1[/youtube]', $body); - - $res['body'] = preg_replace('#].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?#s', - '[youtube]$1[/youtube]', $res['body']); - + $body = html2bb_video($body); $config = HTMLPurifier_Config::createDefault(); $config->set('Cache.DefinitionImpl', null); @@ -629,11 +620,7 @@ function get_atom_elements($feed,$item) { $res['object'] .= '' . xmlify($body) . '' . "\n"; if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) { - $body = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', - '[youtube]$1[/youtube]', $body); - - $res['body'] = preg_replace('#].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?#s', - '[youtube]$1[/youtube]', $res['body']); + $body = html2bb_video($body); $config = HTMLPurifier_Config::createDefault(); $config->set('Cache.DefinitionImpl', null); diff --git a/include/notifier.php b/include/notifier.php index 90111600a..9dc524585 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -779,6 +779,12 @@ function notifier_run($argv, $argc){ } + if($normal_mode) + call_hooks('notifier_normal',$target_item); + + call_hooks('notifier_end',$target_item); + + return; } diff --git a/include/text.php b/include/text.php index fd413b7d6..299410a63 100644 --- a/include/text.php +++ b/include/text.php @@ -1003,3 +1003,37 @@ if (!function_exists('str_getcsv')) { } } } + +function cleardiv() { + return '
'; +} + + +function bb_translate_video($s) { + + $matches = null; + $r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER); + if($r) { + foreach($matches as $mtch) { + if((stristr($mtch[1],'youtube')) || (stristr($mtch[1],'youtu.be'))) + $s = str_replace($mtch[0],'[youtube]' . $mtch[1] . '[/youtube]',$s); + elseif(stristr($mtch[1],'vimeo')) + $s = str_replace($mtch[0],'[vimeo]' . $mtch[1] . '[/vimeo]',$s); + } + } + return $s; +} + +function html2bb_video($s) { + + $s = preg_replace('#]+>(.*?)https+://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)#ism', + '[youtube]$2[/youtube]', $s); + + $s = preg_replace('#](.*?)https+://www.youtube.com/embed/([A-Za-z0-9\-_=]+)(.*?)#ism', + '[youtube]$2[/youtube]', $s); + + $s = preg_replace('#](.*?)https+://player.vimeo.com/video/([0-9]+)(.*?)#ism', + '[vimeo]$2[/vimeo]', $s); + + return $s; +} \ No newline at end of file diff --git a/mod/contacts.php b/mod/contacts.php index ea429d39f..d24873b8f 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -21,6 +21,16 @@ function contacts_init(&$a) { require_once('include/group.php'); if(! x($a->page,'aside')) $a->page['aside'] = ''; + + $a->page['aside'] .= replace_macros(get_markup_template('follow.tpl'),array( + '$connect' => t('Add New Contact'), + '$desc' => t('Enter address or web location'), + '$hint' => t('Example: bob@example.com, http://example.com/barbara'), + '$follow' => t('Connect') + )); + + + $a->page['aside'] .= group_side('contacts','group',false,0,$contact_id); if(get_config('system','invitation_only')) { @@ -32,22 +42,18 @@ function contacts_init(&$a) { } } - $tpl = get_markup_template('follow.tpl'); - - $findSimilarLink = ''; + $tpl = get_markup_template('peoplefind.tpl'); - $inv = ''; - if($a->config['register_policy'] != REGISTER_CLOSED) { - $inv = ''; - } - + $inv = (($a->config['register_policy'] != REGISTER_CLOSED) ? t('Invite Friends') : ''); + $a->page['aside'] .= replace_macros($tpl,array( + '$findpeople' => t('Find People'), + '$desc' => t('Enter name or interest'), '$label' => t('Connect/Follow'), - '$hint' => t('Example: bob@example.com, http://example.com/barbara'), - '$follow' => t('Follow'), - '$findSimilar' => $findSimilarLink, - '$inviteFriends' => $inv + '$hint' => t('Examples: Robert Morgenstein, Fishing'), + '$findthem' => t('Find'), + '$similar' => t('Similar Interests'), + '$inv' => $inv )); @@ -351,6 +357,7 @@ function contacts_content(&$a) { '$hide_url' => ((strlen($sql_extra)) ? 'contacts/all' : 'contacts' ), '$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections')), '$search' => $search, + '$desc' => t('Search your contacts'), '$finding' => (strlen($search) ? '

' . t('Finding: ') . "'" . $search . "'" . '

' : ""), '$submit' => t('Find'), '$cmd' => $a->cmd diff --git a/mod/dirfind.php b/mod/dirfind.php new file mode 100644 index 000000000..2d8479043 --- /dev/null +++ b/mod/dirfind.php @@ -0,0 +1,52 @@ +' . t('People Search') . ' - ' . $search . ''; + + if($search) { + + $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : ''); + + if(strlen(get_config('system','directory_submit_url'))) + $x = fetch_url('http://dir.friendika.com/lsearch?f=' . $p . '&search=' . urlencode($search)); + +//TODO fallback local search if global dir not available. +// else +// $x = post_url($a->get_baseurl() . '/lsearch', $params); + + $j = json_decode($x); + + if($j->total) { + $a->set_pager_total($j->total); + $a->set_pager_itemspage($j->items_page); + } + + if(count($j->results)) { + + $tpl = get_markup_template('match.tpl'); + foreach($j->results as $jj) { + + $o .= replace_macros($tpl,array( + '$url' => $jj->url, + '$name' => $jj->name, + '$photo' => $jj->photo, + '$tags' => $jj->tags + )); + } + } + else { + info( t('No matches') . EOL); + } + + } + + $o .= '
'; + $o .= paginate($a); + return $o; +} diff --git a/mod/item.php b/mod/item.php index 08c5e68b8..9e6d33230 100644 --- a/mod/item.php +++ b/mod/item.php @@ -342,6 +342,8 @@ function item_post(&$a) { } + $body = bb_translate_video($body); + /** * Fold multi-line [code] sequences */ @@ -522,6 +524,7 @@ function item_post(&$a) { $datarray['attach'] = $attachments; $datarray['bookmark'] = intval($bookmark); $datarray['thr-parent'] = $thr_parent; + $datarray['postopts'] = ''; /** * These fields are for the convenience of plugins... @@ -531,7 +534,7 @@ function item_post(&$a) { $datarray['parent'] = $parent; $datarray['self'] = $self; - $datarray['prvnets'] = $user['prvnets']; +// $datarray['prvnets'] = $user['prvnets']; if($orig_post) $datarray['edit'] = true; @@ -563,8 +566,8 @@ function item_post(&$a) { $r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`, - `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark` ) - VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d )", + `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark` ) + VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d )", dbesc($datarray['guid']), intval($datarray['uid']), dbesc($datarray['type']), @@ -592,6 +595,7 @@ function item_post(&$a) { dbesc($datarray['tag']), dbesc($datarray['inform']), dbesc($datarray['verb']), + dbesc($datarray['postopts']), dbesc($datarray['allow_cid']), dbesc($datarray['allow_gid']), dbesc($datarray['deny_cid']), diff --git a/mod/match.php b/mod/match.php index eea2dad4f..c33bbd5c2 100644 --- a/mod/match.php +++ b/mod/match.php @@ -59,6 +59,7 @@ function match_content(&$a) { } + $o .= cleardiv(); $o .= paginate($a); return $o; } diff --git a/mod/ping.php b/mod/ping.php index 546c46f16..23b332ee0 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -165,7 +165,7 @@ function ping_init(&$a) { } if (count($friends)){ foreach ($friends as $i) { - echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friends with %s"), $i['fname'] ) ); + echo xmlize($a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'],$i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friends with %s"), $i['fname'] ) ); }; } if (count($posts)){ @@ -180,16 +180,14 @@ function ping_init(&$a) { if(x($_SESSION,'sysmsg')){ foreach ($_SESSION['sysmsg'] as $m){ - echo "".($m).""; + echo "".xmlify($m).""; } - //$_SESSION['sysmsg']=array(); unset($_SESSION['sysmsg']); } if(x($_SESSION,'sysmsg_info')){ foreach ($_SESSION['sysmsg_info'] as $m){ - echo "".($m).""; + echo "".xmlify($m).""; } - //$_SESSION['sysmsg_info']=array(); unset($_SESSION['sysmsg_info']); } diff --git a/mod/settings.php b/mod/settings.php index 7112db887..b5997fbe7 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -52,6 +52,78 @@ function settings_post(&$a) { return; } + if(($a->argc > 1) && ($a->argv[1] == 'connectors')) { + + if(x($_POST['imap-submit'])) { + $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : ''); + $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : ''); + $mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : ''); + $mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : ''); + $mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : ''); + $mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : ''); + $mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : ''); + + + $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) { + $failed = false; + $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", + intval(local_user()) + ); + if(! count($r)) { + q("INSERT INTO `mailacct` (`uid`) VALUES (%d)", + intval(local_user()) + ); + } + if(strlen($mail_pass)) { + $pass = ''; + openssl_public_encrypt($mail_pass,$pass,$a->user['pubkey']); + q("UPDATE `mailacct` SET `pass` = '%s' WHERE `uid` = %d LIMIT 1", + dbesc(bin2hex($pass)), + intval(local_user()) + ); + } + $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s', + `mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d LIMIT 1", + dbesc($mail_server), + intval($mail_port), + dbesc($mail_ssl), + dbesc($mail_user), + dbesc($mail_replyto), + intval($mail_pubmail), + intval(local_user()) + ); + $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", + intval(local_user()) + ); + if(count($r)) { + $eacct = $r[0]; + require_once('include/email.php'); + $mb = construct_mailbox_name($eacct); + if(strlen($eacct['server'])) { + $dcrpass = ''; + openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']); + $mbox = email_connect($mb,$mail_user,$dcrpass); + unset($dcrpass); + if(! $mbox) { + $failed = true; + notice( t('Failed to connect with email account using the settings provided.') . EOL); + } + } + } + if(! $failed) + info( t('Email settings updated.') . EOL); + } + } + + call_hooks('connector_settings_post', $_POST); + return; + } + + call_hooks('settings_post', $_POST); if((x($_POST,'npassword')) || (x($_POST,'confirm'))) { @@ -103,66 +175,6 @@ function settings_post(&$a) { $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); - - - $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : ''); - $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : ''); - $mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : ''); - $mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : ''); - $mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : ''); - $mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : ''); - $mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : ''); - - - $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", - intval(local_user()) - ); - if(! count($r)) { - q("INSERT INTO `mailacct` (`uid`) VALUES (%d)", - intval(local_user()) - ); - } - if(strlen($mail_pass)) { - $pass = ''; - openssl_public_encrypt($mail_pass,$pass,$a->user['pubkey']); - q("UPDATE `mailacct` SET `pass` = '%s' WHERE `uid` = %d LIMIT 1", - dbesc(bin2hex($pass)), - intval(local_user()) - ); - } - $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s', - `mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d LIMIT 1", - dbesc($mail_server), - intval($mail_port), - dbesc($mail_ssl), - dbesc($mail_user), - dbesc($mail_replyto), - intval($mail_pubmail), - intval(local_user()) - ); - $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", - intval(local_user()) - ); - if(count($r)) { - $eacct = $r[0]; - require_once('include/email.php'); - $mb = construct_mailbox_name($eacct); - if(strlen($eacct['server'])) { - $dcrpass = ''; - openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']); - $mbox = email_connect($mb,$mail_user,$dcrpass); - unset($dcrpass); - if(! $mbox) - notice( t('Failed to connect with email account using the settings provided.') . EOL); - } - } - } - $notify = 0; if(x($_POST,'notify1')) @@ -312,10 +324,20 @@ function settings_content(&$a) { 'url' => $a->get_baseurl().'/settings', 'sel' => (($a->argc == 1)?'active':''), ), + array( + 'label' => t('Connector settings'), + 'url' => $a->get_baseurl().'/settings/connectors', + 'sel' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), + ), array( 'label' => t('Plugin settings'), 'url' => $a->get_baseurl().'/settings/addon', 'sel' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''), + ), + array( + 'label' => t('Export personal data'), + 'url' => $a->get_baseurl() . '/uexport', + 'sel' => '' ) ); @@ -344,29 +366,15 @@ function settings_content(&$a) { )); return $o; } - - require_once('include/acl_selectors.php'); - $p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", - intval(local_user()) - ); - if(count($p)) - $profile = $p[0]; + if(($a->argc > 1) && ($a->argv[1] === 'connectors')) { - $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']; - - if(! strlen($a->user['timezone'])) - $timezone = date_default_timezone_get(); + $settings_connectors = ""; + + call_hooks('connector_settings', $settings_connectors); + $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')) @@ -389,6 +397,60 @@ function settings_content(&$a) { $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0); $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00'); + + $tpl = get_markup_template("settings_connectors.tpl"); + $o .= replace_macros($tpl, array( + '$title' => t('Connector Settings'), + '$tabs' => $tabs, + + '$diasp_enabled' => $diasp_enabled, + '$ostat_enabled' => $ostat_enabled, + + '$h_imap' => t('Email/Mailbox Setup'), + '$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."), + '$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $mail_chk,''), + '$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'), 'TSL'=>'TSL', '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'), + '$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''), + '$submit' => t('Submit'), + + + + '$settings_connectors' => $settings_connectors + )); + return $o; + } + + + require_once('include/acl_selectors.php'); + + $p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", + intval(local_user()) + ); + 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']; + + if(! strlen($a->user['timezone'])) + $timezone = date_default_timezone_get(); + + + $pageset_tpl = get_markup_template('pagetypes.tpl'); $pagetype = replace_macros($pageset_tpl,array( '$page_normal' => array('page-flags', t('Normal Account'), PAGE_NORMAL, @@ -496,8 +558,6 @@ function settings_content(&$a) { '$uid' => local_user(), '$nickname_block' => $prof_addr, - '$uexport' => t('Export Personal Data'), - '$h_pass' => t('Password Settings'), '$password1'=> array('npassword', t('New Password:'), '', ''), @@ -543,21 +603,6 @@ function settings_content(&$a) { - '$h_imap' => t('Email/Mailbox Setup'), - '$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."), - '$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $imap_last_check,''), - '$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'), 'TSL'=>'TSL', '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'), - '$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''), - - - - '$h_advn' => t('Advanced Page Settings'), '$pagetype' => $pagetype, diff --git a/mod/tagmatch.php b/mod/tagmatch.php deleted file mode 100644 index 8023fa433..000000000 --- a/mod/tagmatch.php +++ /dev/null @@ -1,52 +0,0 @@ -' . t('Tag Match') . ' - ' . $search . ''; - - if($search) { - - $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : ''); - - if(strlen(get_config('system','directory_submit_url'))) - $x = fetch_url('http://dir.friendika.com/lsearch?f=' . $p . '&search=' . urlencode($search)); - -//TODO fallback local search if global dir not available. -// else -// $x = post_url($a->get_baseurl() . '/lsearch', $params); - - $j = json_decode($x); - - if($j->total) { - $a->set_pager_total($j->total); - $a->set_pager_itemspage($j->items_page); - } - - if(count($j->results)) { - - $tpl = get_markup_template('match.tpl'); - foreach($j->results as $jj) { - - $o .= replace_macros($tpl,array( - '$url' => $jj->url, - '$name' => $jj->name, - '$photo' => $jj->photo, - '$tags' => $jj->tags - )); - } - } - else { - info( t('No matches') . EOL); - } - - } - - $o .= '
'; - $o .= paginate($a); - return $o; -} diff --git a/update.php b/update.php index 723f12c1a..5d5190095 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@
+$desc
diff --git a/view/follow.tpl b/view/follow.tpl index 2c024930c..259e74a93 100644 --- a/view/follow.tpl +++ b/view/follow.tpl @@ -1,9 +1,8 @@
-

Find People

+

$connect

+
$desc
- $findSimilar - $inviteFriends
diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 5eb07db44..22bd0aa5b 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -149,13 +149,6 @@ function initEditor(cb){ } } - function jotGetVideo() { - reply = prompt("$utubeurl"); - if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]'); - } - } - function jotVideoURL() { reply = prompt("$vidurl"); if(reply && reply.length) { diff --git a/view/jot.tpl b/view/jot.tpl index aa9892cbb..71b92986d 100644 --- a/view/jot.tpl +++ b/view/jot.tpl @@ -32,9 +32,6 @@ -
- -
diff --git a/view/peoplefind.tpl b/view/peoplefind.tpl new file mode 100644 index 000000000..4b3f01b88 --- /dev/null +++ b/view/peoplefind.tpl @@ -0,0 +1,12 @@ +
+

$findpeople

+
$desc
+
+ +
+ + {{ if $inv }} + + {{ endif }} +
+ diff --git a/view/settings.tpl b/view/settings.tpl index b79fbfe43..3bbfc6ffd 100644 --- a/view/settings.tpl +++ b/view/settings.tpl @@ -4,9 +4,6 @@ $tabs $nickname_block - - -
@@ -95,27 +92,6 @@ $hide_wall -{{ if $mail_disabled }} - -{{ else }} -

$h_imap

-

$imap_desc

- {{inc field_custom.tpl with $field=$imap_lastcheck }}{{endinc}} - {{inc field_input.tpl with $field=$mail_server }}{{endinc}} - {{inc field_input.tpl with $field=$mail_port }}{{endinc}} - {{inc field_select.tpl with $field=$mail_ssl }}{{endinc}} - {{inc field_input.tpl with $field=$mail_user }}{{endinc}} - {{inc field_password.tpl with $field=$mail_pass }}{{endinc}} - {{inc field_input.tpl with $field=$mail_replyto }}{{endinc}} - {{inc field_checkbox.tpl with $field=$mail_pubmail }}{{endinc}} - -
- -
-{{ endif }} - - -

$h_advn

diff --git a/view/settings_addons.tpl b/view/settings_addons.tpl index 8fe0b5194..2cbfd17e9 100644 --- a/view/settings_addons.tpl +++ b/view/settings_addons.tpl @@ -3,7 +3,7 @@ $tabs

$title

- + $settings_addons diff --git a/view/settings_connectors.tpl b/view/settings_connectors.tpl new file mode 100644 index 000000000..0f3357873 --- /dev/null +++ b/view/settings_connectors.tpl @@ -0,0 +1,34 @@ +$tabs + +

$title

+ +
$diasp_enabled
+
$ostat_enabled
+ + + +$settings_connectors + +{{ if $mail_disabled }} + +{{ else }} +
+

$h_imap

+

$imap_desc

+ {{inc field_custom.tpl with $field=$imap_lastcheck }}{{endinc}} + {{inc field_input.tpl with $field=$mail_server }}{{endinc}} + {{inc field_input.tpl with $field=$mail_port }}{{endinc}} + {{inc field_select.tpl with $field=$mail_ssl }}{{endinc}} + {{inc field_input.tpl with $field=$mail_user }}{{endinc}} + {{inc field_password.tpl with $field=$mail_pass }}{{endinc}} + {{inc field_input.tpl with $field=$mail_replyto }}{{endinc}} + {{inc field_checkbox.tpl with $field=$mail_pubmail }}{{endinc}} + +
+ +
+
+{{ endif }} + +
+ diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index b46a03c38..40c3cb81b 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -145,7 +145,6 @@ nav .nav-link { background-color: transparent !important; } - .nav-commlink.selected { background-color: #ffffff; border-bottom: 1px solid #ffffff; @@ -1849,13 +1848,28 @@ a.mail-list-link { #side-follow-wrapper { margin-top: 20px; } -#side-follow-url { +#side-follow-url, #side-peoplefind-url { margin-top: 5px; } -#side-follow-submit { +#side-follow-submit, #side-peoplefind-submit { margin-top: 15px; } +#side-match-link { + margin-top: 10px; +} + +.widget { + border: 1px solid #DDDDDD; + padding: 5px; + margin-top: 5px; + -moz-border-radius:5px; + -webkit-border-radius:5px; + border-radius:5px; + +} + + .photo-album-image-wrapper { float: left; margin-top: 15px; @@ -2641,8 +2655,8 @@ a.mail-list-link { border-color:#204A87; padding-right: 40px; background-position: right center; - background-color: #3465A4; - color: #FFFFFF; + background-color: #D7E3F1; + color: #204A87; text-align: left; } .hidden { display: none!important; } diff --git a/view/theme/testbubble/style.css b/view/theme/testbubble/style.css index 341314c1d..dd9d24299 100644 --- a/view/theme/testbubble/style.css +++ b/view/theme/testbubble/style.css @@ -823,7 +823,7 @@ profile-jot-banner-wrapper { /* ======== */ .tabs { - width: 450px; + width: 600px; list-style: none; padding: 10px; margin: 0px 0px 10px 0px; @@ -2211,6 +2211,25 @@ margin-left: 0px; padding: 5px; } +.settings-block { + margin-top: 20px; + -moz-box-shadow: 1px 2px 6px 0px #959494; + -webkit-box-shadow: 1px 2px 6px 0px #959494; + box-shadow: 1px 2px 6px 0px #959494; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f8f8f8), color-stop(1, #f6f6f6) ); + background:-moz-linear-gradient( center top, #f8f8f8 5%, #f6f6f6 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#f6f6f6'); + background-color:#f8f8f8; + -moz-border-radius:5px; + -webkit-border-radius:5px; + border-radius:5px; + border:1px solid #eee; + color:#a6a6a6; + text-shadow:-1px 0px 0px #bdbdbd; + border: 1px solid #cdcdcd; + padding: 5px; +} + #register-form div, #profile-edit-form div { clear: both; -- cgit v1.2.3 From 2206d894b3fec7064b91e0420bcc2b16e9e7009b Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 11 Oct 2011 19:27:58 -0700 Subject: add contact_widgets and provide widgets on appropriate pages, fix the saved search widget fix directory page on testbubble, don't use system theme for community, directory, and search if the viewer is logged in. --- include/contact_widgets.php | 40 ++++++++++++++++++++++++++++++++++++++++ mod/community.php | 10 +++++++--- mod/contacts.php | 36 ++++-------------------------------- mod/directory.php | 16 +++++++++++++--- mod/dirfind.php | 13 +++++++++++++ mod/network.php | 4 +++- mod/search.php | 10 +++++----- view/directory_header.tpl | 1 + view/theme/testbubble/style.css | 4 ++++ 9 files changed, 90 insertions(+), 44 deletions(-) create mode 100644 include/contact_widgets.php diff --git a/include/contact_widgets.php b/include/contact_widgets.php new file mode 100644 index 000000000..efb833aaf --- /dev/null +++ b/include/contact_widgets.php @@ -0,0 +1,40 @@ + t('Add New Contact'), + '$desc' => t('Enter address or web location'), + '$hint' => t('Example: bob@example.com, http://example.com/barbara'), + '$follow' => t('Connect') + )); + +} + +function findpeople_widget() { + + $a = get_app(); + + $inv = (($a->config['register_policy'] != REGISTER_CLOSED) ? t('Invite Friends') : ''); + + if(get_config('system','invitation_only')) { + $x = get_pconfig(local_user(),'system','invites_remaining'); + if($x || is_site_admin()) { + $a->page['aside'] .= '' . $inv; + } + } + + return replace_macros(get_markup_template('peoplefind.tpl'),array( + '$findpeople' => t('Find People'), + '$desc' => t('Enter name or interest'), + '$label' => t('Connect/Follow'), + '$hint' => t('Examples: Robert Morgenstein, Fishing'), + '$findthem' => t('Find'), + '$similar' => t('Similar Interests'), + '$inv' => $inv + )); + +} + diff --git a/mod/community.php b/mod/community.php index cb255029f..34c992bad 100644 --- a/mod/community.php +++ b/mod/community.php @@ -1,5 +1,12 @@ ' . t('Community') . ''; if(! $update) { diff --git a/mod/contacts.php b/mod/contacts.php index d24873b8f..9bbcea07d 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -19,44 +19,16 @@ function contacts_init(&$a) { } require_once('include/group.php'); + require_once('include/contact_widgets.php'); + if(! x($a->page,'aside')) $a->page['aside'] = ''; - $a->page['aside'] .= replace_macros(get_markup_template('follow.tpl'),array( - '$connect' => t('Add New Contact'), - '$desc' => t('Enter address or web location'), - '$hint' => t('Example: bob@example.com, http://example.com/barbara'), - '$follow' => t('Connect') - )); - - + $a->page['aside'] .= follow_widget(); $a->page['aside'] .= group_side('contacts','group',false,0,$contact_id); - if(get_config('system','invitation_only')) { - $x = get_pconfig(local_user(),'system','invites_remaining'); - if($x || is_site_admin()) { - $a->page['aside'] .= '' . $inv; - } - } - - $tpl = get_markup_template('peoplefind.tpl'); - - $inv = (($a->config['register_policy'] != REGISTER_CLOSED) ? t('Invite Friends') : ''); - - $a->page['aside'] .= replace_macros($tpl,array( - '$findpeople' => t('Find People'), - '$desc' => t('Enter name or interest'), - '$label' => t('Connect/Follow'), - '$hint' => t('Examples: Robert Morgenstein, Fishing'), - '$findthem' => t('Find'), - '$similar' => t('Similar Interests'), - '$inv' => $inv - )); - - + $a->page['aside'] .= findpeople_widget(); } diff --git a/mod/directory.php b/mod/directory.php index 93abcd5de..5f00b4f5a 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -2,6 +2,17 @@ function directory_init(&$a) { $a->set_pager_itemspage(60); + + if(local_user()) { + require_once('include/contact_widgets.php'); + + $a->page['aside'] .= findpeople_widget(); + + } + else + unset($_SESSION['theme']); + + } @@ -23,8 +34,6 @@ function directory_content(&$a) { $o = ''; nav_set_selected('directory'); - if(x($_SESSION,'theme')) - unset($_SESSION['theme']); if(x($a->data,'search')) $search = notags(trim($a->data['search'])); @@ -45,12 +54,13 @@ function directory_content(&$a) { if($everything) $admin = ''; else - $admin = ''; + $admin = ''; } $o .= replace_macros($tpl, array( '$search' => $search, '$globaldir' => $globaldir, + '$desc' => t('Find on this site'), '$admin' => $admin, '$finding' => (strlen($search) ? '

' . t('Finding: ') . "'" . $search . "'" . '

' : ""), '$sitedir' => t('Site Directory'), diff --git a/mod/dirfind.php b/mod/dirfind.php index 2d8479043..801018276 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -1,5 +1,18 @@ page,'aside')) + $a->page['aside'] = ''; + + $a->page['aside'] .= follow_widget(); + + $a->page['aside'] .= findpeople_widget(); +} + + function dirfind_content(&$a) { diff --git a/mod/network.php b/mod/network.php index 9b7c4e611..5aa39bf63 100644 --- a/mod/network.php +++ b/mod/network.php @@ -78,11 +78,13 @@ function saved_searches($search) { if(count($r)) { $o .= ''; } + $o .= '
'; + $o .= '' . "\r\n"; return $o; diff --git a/mod/search.php b/mod/search.php index 034794e17..2a8bf1484 100644 --- a/mod/search.php +++ b/mod/search.php @@ -15,7 +15,7 @@ function search_saved_searches() { foreach($r as $rr) { $o .= '
  • ' . $rr['term'] . '
  • ' . "\r\n"; } - $o .= '' . "\r\n"; + $o .= '
    ' . "\r\n"; } return $o; @@ -50,6 +50,9 @@ function search_init(&$a) { $a->page['aside'] .= search_saved_searches(); } + else + unset($_SESSION['theme']); + } @@ -75,12 +78,9 @@ function search_content(&$a) { require_once('include/security.php'); require_once('include/conversation.php'); - if(x($_SESSION,'theme')) - unset($_SESSION['theme']); - $o = '' . "\r\n"; - $o .= '

    ' . t('Search') . '

    '; + $o .= '

    ' . t('Search This Site') . '

    '; if(x($a->data,'search')) $search = notags(trim($a->data['search'])); diff --git a/view/directory_header.tpl b/view/directory_header.tpl index ba90b94f8..1f03540f2 100644 --- a/view/directory_header.tpl +++ b/view/directory_header.tpl @@ -7,6 +7,7 @@ $finding
    +$desc
    diff --git a/view/theme/testbubble/style.css b/view/theme/testbubble/style.css index dd9d24299..74f0dfb41 100644 --- a/view/theme/testbubble/style.css +++ b/view/theme/testbubble/style.css @@ -2614,6 +2614,10 @@ tr { width: 150px; } +.directory-end { + clear: both; +} + /* ========= */ /* = Admin = */ /* ========= */ -- cgit v1.2.3 From 3ef7dcac4b84f6f78dcba5cd768fc08f9cfc1067 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 11 Oct 2011 20:38:09 -0700 Subject: solve intro/notify naming issue by providing both or either, theme decides what to do --- include/nav.php | 5 ++++- view/theme/duepuntozero/nav.tpl | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/nav.php b/include/nav.php index 600043ee5..5c24df51e 100644 --- a/include/nav.php +++ b/include/nav.php @@ -114,7 +114,9 @@ function nav(&$a) { /* only show friend requests for normal pages. Other page types have automatic friendship. */ if($_SESSION['page_flags'] == PAGE_NORMAL) { - $nav['notifications'] = array('notifications/network', t('Notifications'), "", t('Notifications')); + $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests')); + $nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications')); + } $nav['messages'] = array('message', t('Messages'), "", t('Private mail')); @@ -175,6 +177,7 @@ function nav_set_selected($item){ 'network' => null, 'home' => null, 'profiles' => null, + 'introductions' => null, 'notifications' => null, 'messages' => null, 'directory' => null, diff --git a/view/theme/duepuntozero/nav.tpl b/view/theme/duepuntozero/nav.tpl index b13ea9ae2..afa918065 100644 --- a/view/theme/duepuntozero/nav.tpl +++ b/view/theme/duepuntozero/nav.tpl @@ -30,8 +30,8 @@ {{ if $nav.community }} $nav.community.1 {{ endif }} - {{ if $nav.notifications }} - $nav.notifications.1 + {{ if $nav.introductions }} + $nav.introductions.1 {{ endif }} {{ if $nav.messages }} -- cgit v1.2.3 From df7702709b07560af1d469f0835586af317f39b0 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 11 Oct 2011 21:30:23 -0700 Subject: common tabs to notifications and mail --- mod/message.php | 35 +++++++++++++++++++++++------------ mod/notifications.php | 40 +++++++++++++++++++++++++++++++++++++--- view/mail_head.tpl | 9 +-------- view/notifications.tpl | 13 ++----------- 4 files changed, 63 insertions(+), 34 deletions(-) diff --git a/mod/message.php b/mod/message.php index d4772d026..39aa0479f 100644 --- a/mod/message.php +++ b/mod/message.php @@ -45,21 +45,32 @@ function message_content(&$a) { $myprofile = $a->get_baseurl() . '/profile/' . $a->user['nickname']; - if (($a->argc > 1) && ($a->argv[1] === 'new')) { - $tab = 'new'; - } else if ($a->argc == 2 && $a->argv[1] === 'sent') { - $tab = 'sent'; - } else { - $tab = 'inbox'; - } - + + $tabs = array( + array( + 'label' => t('Inbox'), + 'url'=> $a->get_baseurl() . '/message', + 'sel'=> (($a->argc == 1) ? 'active' : ''), + ), + array( + 'label' => t('Outbox'), + 'url' => $a->get_baseurl() . '/message/sent', + 'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''), + ), + array( + 'label' => t('New Message'), + 'url' => $a->get_baseurl() . '/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'); $header = replace_macros($tpl, array( '$messages' => t('Messages'), - '$inbox' => t('Inbox'), - '$outbox' => t('Outbox'), - '$new' => t('New Message'), - '$activetab' => $tab + '$tab_content' => $tab_content )); diff --git a/mod/notifications.php b/mod/notifications.php index 6d78ea024..6c3e67cb4 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -63,10 +63,39 @@ function notifications_content(&$a) { return; } + nav_set_selected('notifications'); + $o = ''; - + $tabs = array( + array( + 'label' => t('Network'), + 'url'=>$a->get_baseurl() . '/notifications/network', + 'sel'=> (($a->argv[1] == 'network') ? 'active' : ''), + ), + array( + 'label' => t('Home'), + 'url' => $a->get_baseurl() . '/notifications/home', + 'sel'=> (($a->argv[1] == 'home') ? 'active' : ''), + ), + array( + 'label' => t('Introductions'), + 'url' => $a->get_baseurl() . '/notifications/intros', + 'sel'=> (($a->argv[1] == 'intros') ? 'active' : ''), + ), + array( + 'label' => t('Messages'), + 'url' => $a->get_baseurl() . '/message', + 'sel'=> '', + ), + ); + $tpl = get_markup_template('common_tabs.tpl'); + $tab_content = replace_macros($tpl, array('$tabs'=>$tabs)); + + + + if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) { - + nav_set_selected('introductions'); if(($a->argc > 2) && ($a->argv[2] == 'all')) $sql_extra = ''; else @@ -167,6 +196,8 @@ function notifications_content(&$a) { info( t('No notifications.') . EOL); $o .= replace_macros($notif_tpl,array( + '$notif_header' => t('Notifications'), + '$tabs' => $tab_content, '$notif_content' => $notif_content, '$activetab' => 'intros' )); @@ -175,7 +206,6 @@ function notifications_content(&$a) { return $o; } else if (($a->argc > 1) && ($a->argv[1] == 'network')) { - $notif_tpl = get_markup_template('notifications.tpl'); $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, @@ -252,6 +282,8 @@ function notifications_content(&$a) { } $o .= replace_macros($notif_tpl,array( + '$notif_header' => t('Notifications'), + '$tabs' => $tab_content, '$notif_content' => $notif_content, '$activetab' => 'network' )); @@ -327,6 +359,8 @@ function notifications_content(&$a) { } $o .= replace_macros($notif_tpl,array( + '$notif_header' => t('Notifications'), + '$tabs' => $tab_content, '$notif_content' => $notif_content, '$activetab' => 'home' )); diff --git a/view/mail_head.tpl b/view/mail_head.tpl index 2aeb3006e..afb65f537 100644 --- a/view/mail_head.tpl +++ b/view/mail_head.tpl @@ -1,10 +1,3 @@

    $messages

    - - +$tab_content diff --git a/view/notifications.tpl b/view/notifications.tpl index 24f78f37e..d737a7507 100644 --- a/view/notifications.tpl +++ b/view/notifications.tpl @@ -1,14 +1,5 @@ - -

    Notifications

    - -

    - Network - Home - Introductions - Messages -

    -
    - +

    $notif_header

    +$tabs
    $notif_content
    -- cgit v1.2.3 From 0fb119496eab2e736d9ea54adef7c9e1237f2799 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 12 Oct 2011 07:47:41 +0200 Subject: some work on quattro theme --- view/theme/quattro/jot.tpl | 80 +++++++++++++++++ view/theme/quattro/quattro.less | 185 ++++++++++++++++++++++++++++++++++++++++ view/theme/quattro/style.css | 178 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 443 insertions(+) create mode 100644 view/theme/quattro/jot.tpl diff --git a/view/theme/quattro/jot.tpl b/view/theme/quattro/jot.tpl new file mode 100644 index 000000000..49c0e9fec --- /dev/null +++ b/view/theme/quattro/jot.tpl @@ -0,0 +1,80 @@ + +
    +
    +
     
    +
    +
    +
    + +
    + + + + + + + + + + + + {{ if $content }}{{ endif }} + + + +
    +
    +
    diff --git a/view/theme/quattro/quattro.less b/view/theme/quattro/quattro.less index 31a25694f..0addb1c70 100644 --- a/view/theme/quattro/quattro.less +++ b/view/theme/quattro/quattro.less @@ -374,4 +374,189 @@ section { border: 1px solid @CommentBoxEmptyBorderColor; padding:0.3em; } +#profile-jot-plugin-wrapper, +#profile-jot-submit-wrapper { + margin-top: 10px; +} + + +#profile-jot-submit { + float: left; +} +#profile-upload-wrapper{ + float: left; + margin-left: 10px; +} +#profile-attach-wrapper, +#profile-rotator, +#profile-link-wrapper, +#profile-youtube-wrapper, +#profile-video-wrapper, +#profile-audio-wrapper, +#profile-location-wrapper, +#profile-nolocation-wrapper, +#profile-title-wrapper { + float: left; + margin-left: 20px; +} + +#profile-jot-perms { + float: left; + margin-left: 35px; + margin-right: 35px; +} + +#profile-jot-perms-end { + /*clear: left;*/ + height: 20px; +} + +#profile-jot-plugin-end{ + clear: both; +} +.profile-jot-net { + float: left; + margin-right: 10px; + margin-top: 5px; + margin-bottom: 5px; +} + +#profile-jot-networks-end { + clear: both; +} + +#profile-jot-end, #about-jot-end { + margin-bottom: 15px; +} +#about-jot-submit-wrapper { + margin-top: 15px; +} +/** buttons **/ +.comment-edit-submit, +#search-submit, +#search-save, +#profile-jot-submit{ + border: 1px solid; + background-color: @BodyColor; + font: bold 85%; + color: @Grey1; + height: 20px; + padding: 10px; + border-radius: 8px; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; +} + + +/** acl **/ +#photo-edit-perms-select, +#photos-upload-permissions-wrapper, +#profile-jot-acl-wrapper{ + display:block!important; +} + + + +#acl-wrapper { + width: 690px; + float:left; +} +#acl-search { + float:right; + background: #ffffff url("../../../images/search_18.png") no-repeat right center; + padding-right:20px; +} +#acl-showall { + float: left; + display: block; + width: auto; + height: 18px; + background-color: #cccccc; + background-image: url("../../../images/show_all_off.png"); + background-position: 7px 7px; + background-repeat: no-repeat; + padding: 7px 5px 0px 30px; + -webkit-border-radius: 5px ; + -moz-border-radius: 5px; + border-radius: 5px; + color: #999999; +} +#acl-showall.selected { + color: #000000; + background-color: #ff9900; + background-image: url("../../../images/show_all_on.png"); +} + +#acl-list { + height: 210px; + border: 1px solid #cccccc; + clear: both; + margin-top: 30px; + overflow: auto; +} +#acl-list-content { + +} +.acl-list-item { + display: block; + width: 150px; + height: 30px; + border: 1px solid #cccccc; + margin: 5px; + float: left; +} +.acl-list-item img{ + width:22px; + height: 22px; + float: left; + margin: 4px; +} +.acl-list-item p { height: 12px; font-size: 10px; margin: 0px; padding: 2px 0px 1px; overflow: hidden;} +.acl-list-item a { + font-size: 8px; + display: block; + width: 40px; + height: 10px; + float: left; + color: #999999; + background-color: #cccccc; + background-position: 3px 3px; + background-repeat: no-repeat; + margin-right: 5px; + -webkit-border-radius: 2px ; + -moz-border-radius: 2px; + border-radius: 2px; + padding-left: 15px; +} +#acl-wrapper a:hover { + text-decoration: none; + color:#000000; +} +.acl-button-show { background-image: url("../../../images/show_off.png"); } +.acl-button-hide { background-image: url("../../../images/hide_off.png"); } + +.acl-button-show.selected { + color: #000000; + background-color: #9ade00; + background-image: url("../../../images/show_on.png"); +} +.acl-button-hide.selected { + color: #000000; + background-color: #ff4141; + background-image: url("../../../images/hide_on.png"); +} +.acl-list-item.groupshow { border-color: #9ade00; } +.acl-list-item.grouphide { border-color: #ff4141; } +/** /acl **/ + +/** tab buttons **/ +ul.tabs { + list-style-type: none; + padding-bottom: 10px; + + li { + float: left; + margin-left: 20px; + } +} diff --git a/view/theme/quattro/style.css b/view/theme/quattro/style.css index f3237801d..3606a05a2 100644 --- a/view/theme/quattro/style.css +++ b/view/theme/quattro/style.css @@ -641,3 +641,181 @@ section { border: 1px solid #999999; padding: 0.3em; } +#profile-jot-plugin-wrapper, #profile-jot-submit-wrapper { + margin-top: 10px; +} +#profile-jot-submit { + float: left; +} +#profile-upload-wrapper { + float: left; + margin-left: 10px; +} +#profile-attach-wrapper, +#profile-rotator, +#profile-link-wrapper, +#profile-youtube-wrapper, +#profile-video-wrapper, +#profile-audio-wrapper, +#profile-location-wrapper, +#profile-nolocation-wrapper, +#profile-title-wrapper { + float: left; + margin-left: 20px; +} +#profile-jot-perms { + float: left; + margin-left: 35px; + margin-right: 35px; +} +#profile-jot-perms-end { + /*clear: left;*/ + + height: 20px; +} +#profile-jot-plugin-end { + clear: both; +} +.profile-jot-net { + float: left; + margin-right: 10px; + margin-top: 5px; + margin-bottom: 5px; +} +#profile-jot-networks-end { + clear: both; +} +#profile-jot-end, #about-jot-end { + margin-bottom: 15px; +} +#about-jot-submit-wrapper { + margin-top: 15px; +} +/** buttons **/ +.comment-edit-submit, +#search-submit, +#search-save, +#profile-jot-submit { + border: 1px solid; + background-color: #2d2d2d; + font: bold 85%; + color: #ffffff; + height: 20px; + padding: 10px; + border-radius: 8px; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; +} +/** acl **/ +#photo-edit-perms-select, #photos-upload-permissions-wrapper, #profile-jot-acl-wrapper { + display: block!important; +} +#acl-wrapper { + width: 690px; + float: left; +} +#acl-search { + float: right; + background: #ffffff url("../../../images/search_18.png") no-repeat right center; + padding-right: 20px; +} +#acl-showall { + float: left; + display: block; + width: auto; + height: 18px; + background-color: #cccccc; + background-image: url("../../../images/show_all_off.png"); + background-position: 7px 7px; + background-repeat: no-repeat; + padding: 7px 5px 0px 30px; + -webkit-border-radius: 5px ; + -moz-border-radius: 5px; + border-radius: 5px; + color: #999999; +} +#acl-showall.selected { + color: #000000; + background-color: #ff9900; + background-image: url("../../../images/show_all_on.png"); +} +#acl-list { + height: 210px; + border: 1px solid #cccccc; + clear: both; + margin-top: 30px; + overflow: auto; +} +.acl-list-item { + display: block; + width: 150px; + height: 30px; + border: 1px solid #cccccc; + margin: 5px; + float: left; +} +.acl-list-item img { + width: 22px; + height: 22px; + float: left; + margin: 4px; +} +.acl-list-item p { + height: 12px; + font-size: 10px; + margin: 0px; + padding: 2px 0px 1px; + overflow: hidden; +} +.acl-list-item a { + font-size: 8px; + display: block; + width: 40px; + height: 10px; + float: left; + color: #999999; + background-color: #cccccc; + background-position: 3px 3px; + background-repeat: no-repeat; + margin-right: 5px; + -webkit-border-radius: 2px ; + -moz-border-radius: 2px; + border-radius: 2px; + padding-left: 15px; +} +#acl-wrapper a:hover { + text-decoration: none; + color: #000000; +} +.acl-button-show { + background-image: url("../../../images/show_off.png"); +} +.acl-button-hide { + background-image: url("../../../images/hide_off.png"); +} +.acl-button-show.selected { + color: #000000; + background-color: #9ade00; + background-image: url("../../../images/show_on.png"); +} +.acl-button-hide.selected { + color: #000000; + background-color: #ff4141; + background-image: url("../../../images/hide_on.png"); +} +.acl-list-item.groupshow { + border-color: #9ade00; +} +.acl-list-item.grouphide { + border-color: #ff4141; +} +/** /acl **/ +/** tab buttons **/ +ul.tabs { + list-style-type: none; + padding-bottom: 10px; +} +ul.tabs li { + float: left; + margin-left: 20px; +} -- cgit v1.2.3 From 714319457c60c47e0d674c70169677db5ccb57fc Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 12 Oct 2011 08:06:41 +0200 Subject: little bit more for quattro --- view/theme/quattro/quattro.less | 2 +- view/theme/quattro/style.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/view/theme/quattro/quattro.less b/view/theme/quattro/quattro.less index 0addb1c70..ad7584a16 100644 --- a/view/theme/quattro/quattro.less +++ b/view/theme/quattro/quattro.less @@ -441,7 +441,7 @@ section { font: bold 85%; color: @Grey1; height: 20px; - padding: 10px; + padding: 10px 5px; border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; diff --git a/view/theme/quattro/style.css b/view/theme/quattro/style.css index 3606a05a2..aec3b8930 100644 --- a/view/theme/quattro/style.css +++ b/view/theme/quattro/style.css @@ -701,7 +701,7 @@ section { font: bold 85%; color: #ffffff; height: 20px; - padding: 10px; + padding: 10px 5px; border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; -- cgit v1.2.3 From 98e50a05592a22c335303acd1830b84427470b3d Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 12 Oct 2011 09:28:19 +0200 Subject: better do all the buttons (quattro) --- view/theme/quattro/quattro.less | 5 +---- view/theme/quattro/style.css | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/view/theme/quattro/quattro.less b/view/theme/quattro/quattro.less index ad7584a16..9f47cf099 100644 --- a/view/theme/quattro/quattro.less +++ b/view/theme/quattro/quattro.less @@ -432,10 +432,7 @@ section { margin-top: 15px; } /** buttons **/ -.comment-edit-submit, -#search-submit, -#search-save, -#profile-jot-submit{ +input[type="submit"] { border: 1px solid; background-color: @BodyColor; font: bold 85%; diff --git a/view/theme/quattro/style.css b/view/theme/quattro/style.css index aec3b8930..56c4bc967 100644 --- a/view/theme/quattro/style.css +++ b/view/theme/quattro/style.css @@ -692,10 +692,7 @@ section { margin-top: 15px; } /** buttons **/ -.comment-edit-submit, -#search-submit, -#search-save, -#profile-jot-submit { +input[type="submit"] { border: 1px solid; background-color: #2d2d2d; font: bold 85%; -- cgit v1.2.3 From 3db43d5a39813f852bad8f4fe90e4c27400b7fae Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 12 Oct 2011 02:21:18 -0700 Subject: storage race condition --- include/items.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/include/items.php b/include/items.php index 4862ca578..2c23c6f1b 100644 --- a/include/items.php +++ b/include/items.php @@ -677,7 +677,7 @@ function item_store($arr,$force_parent = false) { if($arr['gravity']) $arr['gravity'] = intval($arr['gravity']); - elseif($arr['parent-uri'] == $arr['uri']) + elseif($arr['parent-uri'] === $arr['uri']) $arr['gravity'] = 0; elseif(activity_match($arr['verb'],ACTIVITY_POST)) $arr['gravity'] = 6; @@ -744,7 +744,7 @@ function item_store($arr,$force_parent = false) { // find the parent and snarf the item id and ACL's // and anything else we need to inherit - $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC LIMIT 1", dbesc($arr['parent-uri']), intval($arr['uid']) ); @@ -758,7 +758,8 @@ function item_store($arr,$force_parent = false) { if($r[0]['uri'] != $r[0]['parent-uri']) { $arr['thr-parent'] = $arr['parent-uri']; $arr['parent-uri'] = $r[0]['parent-uri']; - $z = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `parent-uri` = '%s' AND `uid` = %d LIMIT 1", + $z = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `parent-uri` = '%s' AND `uid` = %d + ORDER BY `id` ASC LIMIT 1", dbesc($r[0]['parent-uri']), dbesc($r[0]['parent-uri']), intval($arr['uid']) @@ -796,7 +797,7 @@ function item_store($arr,$force_parent = false) { $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($arr['uri']), - dbesc($arr['uid']) + intval($arr['uid']) ); if($r && count($r)) { logger('item-store: duplicate item ignored. ' . print_r($arr,true)); @@ -817,14 +818,14 @@ function item_store($arr,$force_parent = false) { // find the item we just created - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1 ORDER BY `id` ASC", $arr['uri'], // already dbesc'd intval($arr['uid']) ); if(! count($r)) { // This is not good, but perhaps we encountered a rare race/cache condition, so back off and try again. sleep(3); - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1 ORDER BY `id` ASC", $arr['uri'], // already dbesc'd intval($arr['uid']) ); @@ -838,6 +839,14 @@ function item_store($arr,$force_parent = false) { logger('item_store: could not locate created item'); return 0; } + if(count($r) > 1) { + logger('item_store: duplicated post occurred. Removing duplicates.'); + q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `id` != %d ", + $arr['uri'], + intval($arr['uid']), + intval($current_post) + ); + } if((! $parent_id) || ($arr['parent-uri'] === $arr['uri'])) $parent_id = $current_post; @@ -2398,8 +2407,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false) { if(strlen($item['owner-name'])) $o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']); - if($item['parent'] != $item['id']) - $o .= '' . "\r\n"; + if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri'])) + $o .= '' . "\r\n"; $o .= '' . xmlify($item['uri']) . '' . "\r\n"; $o .= '' . xmlify($item['title']) . '' . "\r\n"; -- cgit v1.2.3 From 2911bf9434cb1a061ff32d41894ee0dd09ed3993 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 13 Oct 2011 01:00:06 -0700 Subject: sql issue item_store --- boot.php | 2 +- include/items.php | 4 ++-- view/theme/duepuntozero/style.css | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/boot.php b/boot.php index f483d32f3..fb406867d 100644 --- a/boot.php +++ b/boot.php @@ -8,7 +8,7 @@ require_once("include/pgettext.php"); require_once('include/nav.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); -define ( 'FRIENDIKA_VERSION', '2.3.1131' ); +define ( 'FRIENDIKA_VERSION', '2.3.1132' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1095 ); diff --git a/include/items.php b/include/items.php index 2c23c6f1b..36851b01f 100644 --- a/include/items.php +++ b/include/items.php @@ -818,14 +818,14 @@ function item_store($arr,$force_parent = false) { // find the item we just created - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1 ORDER BY `id` ASC", + $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC LIMIT 1", $arr['uri'], // already dbesc'd intval($arr['uid']) ); if(! count($r)) { // This is not good, but perhaps we encountered a rare race/cache condition, so back off and try again. sleep(3); - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1 ORDER BY `id` ASC", + $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC LIMIT 1", $arr['uri'], // already dbesc'd intval($arr['uid']) ); diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 40c3cb81b..9bb866e76 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -1861,7 +1861,7 @@ a.mail-list-link { .widget { border: 1px solid #DDDDDD; - padding: 5px; + padding: 8px; margin-top: 5px; -moz-border-radius:5px; -webkit-border-radius:5px; -- cgit v1.2.3 From d60505ffb088048b7ebcb7e44a15cd454cbd6f1e Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 13 Oct 2011 01:12:03 -0700 Subject: missing arg xmlize x is friends with y --- mod/ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/ping.php b/mod/ping.php index 23b332ee0..caa78f9b7 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -165,7 +165,7 @@ function ping_init(&$a) { } if (count($friends)){ foreach ($friends as $i) { - echo xmlize($a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'],$i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friends with %s"), $i['fname'] ) ); + echo xmlize($a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'],$i['author-name'],$i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friends with %s"), $i['fname'] ) ); }; } if (count($posts)){ -- cgit v1.2.3 From 4eae1e5d8a37f206177c8eeb379c0f32aa84d5ab Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 13 Oct 2011 15:32:43 -0700 Subject: don't propagate deletions for other people's stuff --- boot.php | 2 +- include/notifier.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/boot.php b/boot.php index fb406867d..376def64d 100644 --- a/boot.php +++ b/boot.php @@ -8,7 +8,7 @@ require_once("include/pgettext.php"); require_once('include/nav.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); -define ( 'FRIENDIKA_VERSION', '2.3.1132' ); +define ( 'FRIENDIKA_VERSION', '2.3.1133' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1095 ); diff --git a/include/notifier.php b/include/notifier.php index 9dc524585..bbddee109 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -192,6 +192,8 @@ function notifier_run($argv, $argc){ // be notified during this run. // Other DFRN conversation members will be alerted during polled updates. + + // Diaspora members currently are not notified of expirations, and other networks have // either limited or no ability to process deletions. We should at least fix Diaspora // by stringing togther an array of retractions and sending them onward. @@ -210,6 +212,7 @@ function notifier_run($argv, $argc){ */ if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) { + logger('notifier: followup', LOGGER_DEBUG); // local followup to remote post $followup = true; $public_message = false; // not public @@ -218,6 +221,13 @@ function notifier_run($argv, $argc){ else { $followup = false; + // don't send deletions onward for other people's stuff + + if($target_item['deleted'] && (! intval($target_item['wall']))) { + logger('notifier: ignoring delete notification for non-wall item'); + return; + } + if((strlen($parent['allow_cid'])) || (strlen($parent['allow_gid'])) || (strlen($parent['deny_cid'])) @@ -357,6 +367,7 @@ function notifier_run($argv, $argc){ if(($public_message) && $item['private']) continue; + $contact = get_item_contact($item,$contacts); if(! $contact) -- cgit v1.2.3 From 89c771a26e2eca3af8de82a5d57ce05d663ff6d5 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 13 Oct 2011 15:39:05 -0700 Subject: remove queued items for contact when removing contact --- include/Contact.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/Contact.php b/include/Contact.php index 45920041e..45fd368d8 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -46,6 +46,10 @@ function contact_remove($id) { q("DELETE FROM `event` WHERE `cid` = %d ", intval($id) ); + q("DELETE FROM `queue` WHERE `cid` = %d ", + intval($id) + ); + } -- cgit v1.2.3 From 05e26e489580c82d0db237771d159aed287c5f9b Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 13 Oct 2011 18:32:02 -0700 Subject: handle diaspora profile update message --- include/diaspora.php | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/include/diaspora.php b/include/diaspora.php index 968aa2fd2..7207daf0c 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -38,6 +38,9 @@ function diaspora_dispatch($importer,$msg) { elseif($xmlbase->status_message) { $ret = diaspora_post($importer,$xmlbase->status_message); } + elseif($xmlbase->profile) { + $ret = diaspora_profile($importer,$xmlbase->profile); + } elseif($xmlbase->comment) { $ret = diaspora_comment($importer,$xmlbase->comment,$msg); } @@ -994,6 +997,81 @@ function diaspora_retraction($importer,$xml) { return 202; // NOTREACHED } + +function diaspora_profile($importer,$xml) { + + $a = get_app(); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + + $contact = diaspora_get_contact_by_handle($importer['uid'],$diaspora_handle); + if(! $contact) + return; + + if($contact['blocked']) { + logger('diaspora_post: Ignoring this author.'); + return 202; + } + + $name = unxmlify($xml->first_name) . ((strlen($xml->last_name)) ? ' ' . unxmlify($xml->last_name) : ''); + $image_url = unxmlify($xml->image_url); + $birthday = unxmlify($xml->birthday); + + $r = q("SELECT DISTINCT ( `resource-id` ) FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' ", + intval($importer['uid']), + intval($contact['id']) + ); + $oldphotos = ((count($r)) ? $r : null); + + $images = import_profile_photo($image_url,$importer['uid'],$contact['id']); + + // TODO handle birthdays - even though we don't know the original timezone (grrr.) + + $r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", + dbesc($name), + dbesc(datetime_convert()), + dbesc($images[0]), + dbesc($images[1]), + dbesc($images[2]), + dbesc(datetime_convert()), + intval($contact['id']), + intval($importer['uid']) + ); + if($r) { + if($oldphotos) { + foreach($oldphotos as $ph) { + q("DELETE FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' AND `resource-id` = '%s' ", + intval($importer['uid']), + intval($contact['id']), + dbesc($ph['resource-id']) + ); + } + } + } + + return; + +} + + + + + + + + + + + + + + + + + + + + + function diaspora_share($me,$contact) { $a = get_app(); -- cgit v1.2.3 From af6ab381000346f487d1b5b07623510640dd7ee5 Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 14 Oct 2011 00:20:37 -0700 Subject: diaspora birthday notifications --- boot.php | 17 +++++++++---- database.sql | 1 + include/datetime.php | 54 +++++++++++++++++++++++++++++++++++++++++ include/diaspora.php | 9 ++++--- include/poller.php | 5 +++- update.php | 6 ++++- view/theme/testbubble/style.css | 9 ++++++- 7 files changed, 90 insertions(+), 11 deletions(-) diff --git a/boot.php b/boot.php index 376def64d..2f2a2127f 100644 --- a/boot.php +++ b/boot.php @@ -10,7 +10,7 @@ require_once('include/nav.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); define ( 'FRIENDIKA_VERSION', '2.3.1133' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1095 ); +define ( 'DB_UPDATE_VERSION', 1096 ); define ( 'EOL', "
    \r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -974,6 +974,7 @@ function get_birthdays() { return $o; $bd_format = t('g A l F d') ; // 8 AM Friday January 18 + $bd_short = t('F d'); $r = q("SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event` LEFT JOIN `contact` ON `contact`.`id` = `event`.`cid` @@ -993,7 +994,7 @@ function get_birthdays() { if($total) { $o .= ''; $o .= ''; diff --git a/database.sql b/database.sql index ed92aa4c1..2b9be34e0 100644 --- a/database.sql +++ b/database.sql @@ -96,6 +96,7 @@ CREATE TABLE IF NOT EXISTS `contact` ( `info` mediumtext NOT NULL, `profile-id` int(11) NOT NULL DEFAULT '0', `bdyear` CHAR( 4 ) NOT NULL COMMENT 'birthday notify flag', + `bd` date NOT NULL, PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `self` (`self`), diff --git a/include/datetime.php b/include/datetime.php index 3033b88af..087e6cb20 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -393,3 +393,57 @@ function cal($y = 0,$m = 0, $links = false, $class='') { return $o; }} + + +function update_contact_birthdays() { + + // This only handles foreign or alien networks where a birthday has been provided. + // In-network birthdays are handled within local_delivery + + $r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` "); + if(count($r)) { + foreach($r as $rr) { + + logger('update_contact_birthday: ' . $rr['bd']); + + $nextbd = datetime_convert('UTC','UTC','now','Y') . substr($rr['bd'],4); + + /** + * + * Add new birthday event for this person + * + * $bdtext is just a readable placeholder in case the event is shared + * with others. We will replace it during presentation to our $importer + * to contain a sparkle link and perhaps a photo. + * + */ + + $bdtext = t('Birthday:') . ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]' ; + + + $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`desc`,`type`,`adjust`) + VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ", + intval($rr['uid']), + intval($rr['id']), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc(datetime_convert('UTC','UTC', $nextbd)), + dbesc(datetime_convert('UTC','UTC', $nextbd . ' + 1 day ')), + dbesc($bdtext), + dbesc('birthday'), + intval(0) + ); + + + // update bdyear + + q("UPDATE `contact` SET `bdyear` = '%s', `bd` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", + dbesc(substr($nextbd,0,4)), + dbesc($nextbd), + intval($rr['uid']), + intval($rr['id']) + ); + + } + } +} \ No newline at end of file diff --git a/include/diaspora.php b/include/diaspora.php index 7207daf0c..2d9e2883d 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1024,9 +1024,11 @@ function diaspora_profile($importer,$xml) { $images = import_profile_photo($image_url,$importer['uid'],$contact['id']); - // TODO handle birthdays - even though we don't know the original timezone (grrr.) + // Generic birthday. We don't know the timezone. The year is irrelevant. - $r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", + $birthday = datetime_convert('UTC','UTC',$birthday,'Y-m-d'); + + $r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", dbesc($name), dbesc(datetime_convert()), dbesc($images[0]), @@ -1034,7 +1036,8 @@ function diaspora_profile($importer,$xml) { dbesc($images[2]), dbesc(datetime_convert()), intval($contact['id']), - intval($importer['uid']) + intval($importer['uid']), + dbesc($birthday) ); if($r) { if($oldphotos) { diff --git a/include/poller.php b/include/poller.php index 427f8887c..cef0647b5 100644 --- a/include/poller.php +++ b/include/poller.php @@ -50,12 +50,15 @@ function poller_run($argv, $argc){ - // once daily run expire in background + // once daily run birthday_updates and then expire in background $d1 = get_config('system','last_expire_day'); $d2 = intval(datetime_convert('UTC','UTC','now','d')); if($d2 != intval($d1)) { + + update_contact_birthdays(); + set_config('system','last_expire_day',$d2); proc_run('php','include/expire.php'); } diff --git a/update.php b/update.php index 5d5190095..06bbb8b41 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ Date: Sat, 15 Oct 2011 03:26:37 -0700 Subject: working on long-term solution to relay issue --- boot.php | 4 ++-- database.sql | 2 ++ include/items.php | 18 +++++++----------- include/notifier.php | 11 +++++++++-- update.php | 8 +++++++- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/boot.php b/boot.php index 2f2a2127f..9f382b302 100644 --- a/boot.php +++ b/boot.php @@ -8,9 +8,9 @@ require_once("include/pgettext.php"); require_once('include/nav.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); -define ( 'FRIENDIKA_VERSION', '2.3.1133' ); +define ( 'FRIENDIKA_VERSION', '2.3.1134' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1096 ); +define ( 'DB_UPDATE_VERSION', 1097 ); define ( 'EOL', "
    \r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 2b9be34e0..c9e239075 100644 --- a/database.sql +++ b/database.sql @@ -214,6 +214,7 @@ CREATE TABLE IF NOT EXISTS `item` ( `bookmark` tinyint(1) NOT NULL DEFAULT '0', `unseen` tinyint(1) NOT NULL DEFAULT '1', `deleted` tinyint(1) NOT NULL DEFAULT '0', + `origin` tinyint(1) NOT NULL DEFAULT '0', `last-child` tinyint(1) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`id`), KEY `guid` (`guid`), @@ -231,6 +232,7 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `visible` (`visible`), KEY `starred` (`starred`), KEY `deleted` (`deleted`), + KEY `origin` (`origin`), KEY `last-child` (`last-child`), KEY `unseen` (`unseen`), FULLTEXT KEY `title` (`title`), diff --git a/include/items.php b/include/items.php index 36851b01f..0c3c8b1d7 100644 --- a/include/items.php +++ b/include/items.php @@ -818,18 +818,10 @@ function item_store($arr,$force_parent = false) { // find the item we just created - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC LIMIT 1", + $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC ", $arr['uri'], // already dbesc'd intval($arr['uid']) ); - if(! count($r)) { - // This is not good, but perhaps we encountered a rare race/cache condition, so back off and try again. - sleep(3); - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC LIMIT 1", - $arr['uri'], // already dbesc'd - intval($arr['uid']) - ); - } if(count($r)) { $current_post = $r[0]['id']; @@ -1873,13 +1865,14 @@ function local_delivery($importer,$data) { $r = q("select `item`.`id`, `contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `contact`.`self` = 1 AND `item`.`wall` = 1 AND `item`.`uri` = '%s' AND `item`.`uid` = %d LIMIT 1", + WHERE `contact`.`self` = 1 AND `item`.`wall` = 1 AND `item`.`uri` = '%s' AND `item`.`parent-uri` = '%s' + AND `item`.`uid` = %d LIMIT 1", + dbesc($parent_uri), dbesc($parent_uri), intval($importer['importer_uid']) ); if($r && count($r)) { - logger('local_delivery: received remote comment'); $is_like = false; // remote reply to our post. Import and then notify everybody else. @@ -2388,6 +2381,9 @@ function atom_entry($item,$type,$author,$owner,$comment = false) { $a = get_app(); + if(! $item['parent']) + return; + if($item['deleted']) return '' . "\r\n"; diff --git a/include/notifier.php b/include/notifier.php index bbddee109..18ad07012 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -142,7 +142,7 @@ function notifier_run($argv, $argc){ $item['deleted'] = 1; } - if((count($items) == 1) && ($items[0]['uri'] === $items[0]['parent-uri'])) { + if((count($items) == 1) && ($items[0]['id'] === $target_item['id']) && ($items[0]['uri'] === $items[0]['parent-uri'])) { logger('notifier: top level post'); $top_level = true; } @@ -205,13 +205,20 @@ function notifier_run($argv, $argc){ /** * - * Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes + * Be VERY CAREFUL if you make any changes to the following lines. Seemingly innocuous changes * have been known to cause runaway conditions which affected several servers, along with * permissions issues. * */ + $relay_to_owner = false; + if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) { + $relay_to_owner = true; + } + + + if($relay_to_owner) { logger('notifier: followup', LOGGER_DEBUG); // local followup to remote post $followup = true; diff --git a/update.php b/update.php index 06bbb8b41..ed6b9e05e 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ Date: Mon, 17 Oct 2011 07:48:33 +0200 Subject: video button only for dispy and quattro --- view/theme/dispy/jot.tpl | 3 --- view/theme/quattro/jot.tpl | 3 --- 2 files changed, 6 deletions(-) diff --git a/view/theme/dispy/jot.tpl b/view/theme/dispy/jot.tpl index f6bf91ffa..a2c883e4b 100644 --- a/view/theme/dispy/jot.tpl +++ b/view/theme/dispy/jot.tpl @@ -37,9 +37,6 @@ - diff --git a/view/theme/quattro/jot.tpl b/view/theme/quattro/jot.tpl index 49c0e9fec..d65ac8b17 100644 --- a/view/theme/quattro/jot.tpl +++ b/view/theme/quattro/jot.tpl @@ -31,9 +31,6 @@ -
    - youtube -
    -- cgit v1.2.3