aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-10-17 16:37:37 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-10-17 16:37:37 +0200
commit2116943964e0c10984976f6d38eba044e35f983a (patch)
treec351abcd1ccd033c36b472f73d087a8343ee638d /mod
parent906addf865ccab2c98d5035fc6c1b10d43004dfe (diff)
parent1df892ebbce59ac6293eacbe065ebc71826b4d85 (diff)
downloadvolse-hubzilla-2116943964e0c10984976f6d38eba044e35f983a.tar.gz
volse-hubzilla-2116943964e0c10984976f6d38eba044e35f983a.tar.bz2
volse-hubzilla-2116943964e0c10984976f6d38eba044e35f983a.zip
Merge remote-tracking branch 'friendika/master'
Diffstat (limited to 'mod')
-rw-r--r--mod/community.php10
-rw-r--r--mod/contacts.php33
-rw-r--r--mod/directory.php16
-rw-r--r--mod/dirfind.php (renamed from mod/tagmatch.php)17
-rw-r--r--mod/item.php10
-rw-r--r--mod/match.php1
-rw-r--r--mod/message.php35
-rw-r--r--mod/network.php4
-rw-r--r--mod/notifications.php65
-rw-r--r--mod/ping.php8
-rw-r--r--mod/search.php10
-rw-r--r--mod/settings.php239
12 files changed, 269 insertions, 179 deletions
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 @@
<?php
+function community_init(&$a) {
+ if(! local_user())
+ unset($_SESSION['theme']);
+
+
+}
+
function community_content(&$a, $update = 0) {
@@ -19,9 +26,6 @@ function community_content(&$a, $update = 0) {
require_once('include/security.php');
require_once('include/conversation.php');
- if(x($_SESSION,'theme'))
- unset($_SESSION['theme']);
-
$o .= '<h3>' . t('Community') . '</h3>';
if(! $update) {
diff --git a/mod/contacts.php b/mod/contacts.php
index ea429d39f..9bbcea07d 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -19,38 +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'] .= 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'] .= '<div class="side-link" id="side-invite-remain">'
- . sprintf( tt('%d invitation available','%d invitations available',$x), $x)
- . '</div>' . $inv;
- }
- }
+ $a->page['aside'] .= follow_widget();
- $tpl = get_markup_template('follow.tpl');
-
- $findSimilarLink = '<div class="side-link" id="side-match-link"><a href="match" >'
- . t('Similar Interests') . '</a></div>';
-
- $inv = '';
- if($a->config['register_policy'] != REGISTER_CLOSED) {
- $inv = '<div class="side-link" id="side-invite-link" ><a href="invite" >' . t("Invite Friends") . '</a></div>';
- }
-
- $a->page['aside'] .= replace_macros($tpl,array(
- '$label' => t('Connect/Follow'),
- '$hint' => t('Example: bob@example.com, http://example.com/barbara'),
- '$follow' => t('Follow'),
- '$findSimilar' => $findSimilarLink,
- '$inviteFriends' => $inv
- ));
+ $a->page['aside'] .= group_side('contacts','group',false,0,$contact_id);
-
+ $a->page['aside'] .= findpeople_widget();
}
@@ -351,6 +329,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) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
'$submit' => t('Find'),
'$cmd' => $a->cmd
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 = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory' . '">' . t('Normal site view') . '</a></div></li></ul>';
else
- $admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory/all' . '">' . t('View all site entries') . '</a></div></li></ul>';
+ $admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory/all' . '">' . t('Admin - View all site entries') . '</a></div></li></ul>';
}
$o .= replace_macros($tpl, array(
'$search' => $search,
'$globaldir' => $globaldir,
+ '$desc' => t('Find on this site'),
'$admin' => $admin,
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
'$sitedir' => t('Site Directory'),
diff --git a/mod/tagmatch.php b/mod/dirfind.php
index 8023fa433..801018276 100644
--- a/mod/tagmatch.php
+++ b/mod/dirfind.php
@@ -1,13 +1,26 @@
<?php
+function dirfind_init(&$a) {
-function tagmatch_content(&$a) {
+ require_once('include/contact_widgets.php');
+
+ if(! x($a->page,'aside'))
+ $a->page['aside'] = '';
+
+ $a->page['aside'] .= follow_widget();
+
+ $a->page['aside'] .= findpeople_widget();
+}
+
+
+
+function dirfind_content(&$a) {
$search = notags(trim($_REQUEST['search']));
$o = '';
- $o .= '<h2>' . t('Tag Match') . ' - ' . $search . '</h2>';
+ $o .= '<h2>' . t('People Search') . ' - ' . $search . '</h2>';
if($search) {
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/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/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 .= '<ul id="saved-search-ul">' . "\r\n";
foreach($r as $rr) {
- $o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . urlencode($rr['term']) . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
+ $o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f=&search=' . urlencode($rr['term']) . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
}
$o .= '</ul>';
}
+ $o .= '<div class="clear"></div>';
+
$o .= '</div>' . "\r\n";
return $o;
diff --git a/mod/notifications.php b/mod/notifications.php
index 52ce90e14..9761a944d 100644
--- a/mod/notifications.php
+++ b/mod/notifications.php
@@ -62,28 +62,46 @@ function notifications_content(&$a) {
notice( t('Permission denied.') . EOL);
return;
}
-
- $notif_tpl = get_markup_template('notifications.tpl');
-
+
+ nav_set_selected('notifications');
+
+ $o = '';
$tabs = array(
- 'net' => array('label' => t('Network'), 'url'=>$a->get_baseurl().'/notifications/network', 'sel'=>''),
- 'home' => array('label' => t('Home'), 'url'=>$a->get_baseurl().'/notifications/home', 'sel'=>''),
- 'intros'=> array('label' => t('Introductions'), 'url'=>$a->get_baseurl().'/notifications/intros', 'sel'=>''),
- 'msg' => array('label' => t('Messages'), 'url'=>$a->get_baseurl().'/message', 'sel'=>''),
+ 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'=> '',
+ ),
);
-
-
-
- $o = '';
+ $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
$sql_extra = " AND `ignore` = 0 ";
-
+ $notif_tpl = get_markup_template('notifications.tpl');
$notif_content .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >'
. ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
@@ -175,12 +193,13 @@ function notifications_content(&$a) {
}
}
else
- $notif_content .= t('<p>No notifications.</p>');
-
- $tabs['intros']['sel']='active';
+ info( t('No notifications.') . EOL);
+
$o .= replace_macros($notif_tpl,array(
+ '$notif_header' => t('Notifications'),
+ '$tabs' => $tab_content,
'$notif_content' => $notif_content,
- '$tabs' => $tabs,
+ '$activetab' => 'intros'
));
$o .= paginate($a);
@@ -188,6 +207,7 @@ function notifications_content(&$a) {
} 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`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
@@ -262,14 +282,16 @@ function notifications_content(&$a) {
$notif_content = t('Nothing new!');
}
- $tabs['net']['sel']='active';
$o .= replace_macros($notif_tpl,array(
+ '$notif_header' => t('Notifications'),
+ '$tabs' => $tab_content,
'$notif_content' => $notif_content,
- '$tabs' => $tabs,
+ '$activetab' => 'network'
));
} else if (($a->argc > 1) && ($a->argv[1] == 'home')) {
+ $notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
@@ -337,10 +359,11 @@ function notifications_content(&$a) {
$notif_content = t('Nothing new!');
}
- $tabs['home']['sel'] = 'active';
$o .= replace_macros($notif_tpl,array(
+ '$notif_header' => t('Notifications'),
+ '$tabs' => $tab_content,
'$notif_content' => $notif_content,
- '$tabs' => $tabs,
+ '$activetab' => 'home'
));
}
diff --git a/mod/ping.php b/mod/ping.php
index 546c46f16..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-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-name'],$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 "<notice>".($m)."</notice>";
+ echo "<notice>".xmlify($m)."</notice>";
}
- //$_SESSION['sysmsg']=array();
unset($_SESSION['sysmsg']);
}
if(x($_SESSION,'sysmsg_info')){
foreach ($_SESSION['sysmsg_info'] as $m){
- echo "<info>".($m)."</info>";
+ echo "<info>".xmlify($m)."</info>";
}
- //$_SESSION['sysmsg_info']=array();
unset($_SESSION['sysmsg_info']);
}
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 .= '<li class="saved-search-li clear"><a href="search/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="search/?f=&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
}
- $o .= '</ul></div>' . "\r\n";
+ $o .= '</ul><div class="clear"></div></div>' . "\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 = '<div id="live-search"></div>' . "\r\n";
- $o .= '<h3>' . t('Search') . '</h3>';
+ $o .= '<h3>' . t('Search This Site') . '</h3>';
if(x($a->data,'search'))
$search = notags(trim($a->data['search']));
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'))
@@ -313,9 +325,19 @@ function settings_content(&$a) {
'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,