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. --- 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 ------------ 7 files changed, 225 insertions(+), 170 deletions(-) create mode 100644 mod/dirfind.php delete mode 100644 mod/tagmatch.php (limited to 'mod') 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; -} -- cgit v1.2.3