aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-11-05 17:17:21 -0800
committerfriendica <info@friendica.com>2012-11-05 17:17:21 -0800
commitfe5f511f19640668afe2387f8d588b821cf5f1b8 (patch)
treeb55787bb5433c4a3f635f016ae4d9e8ae523d7d4
parent4f1170b65618f6455f6432a8b90152fe45d4eeea (diff)
downloadvolse-hubzilla-fe5f511f19640668afe2387f8d588b821cf5f1b8.tar.gz
volse-hubzilla-fe5f511f19640668afe2387f8d588b821cf5f1b8.tar.bz2
volse-hubzilla-fe5f511f19640668afe2387f8d588b821cf5f1b8.zip
more work on the settings pages
-rw-r--r--include/features.php2
-rw-r--r--install/htconfig.sample.php28
-rw-r--r--mod/settings.php190
-rw-r--r--view/css/mod_settings.css9
-rw-r--r--view/tpl/settings.tpl25
-rw-r--r--view/tpl/settings_account.tpl28
6 files changed, 153 insertions, 129 deletions
diff --git a/include/features.php b/include/features.php
index dfed4ad02..5ed412698 100644
--- a/include/features.php
+++ b/include/features.php
@@ -25,7 +25,7 @@ array('archives', t('Search by Date'), t('Select posts by date ranges'))
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')),
array('preview', t('Post Preview'), t('Preview posts and comments before publishing them')),
-array('edit_posts', t('Edit Sent Posts'), t('Edit/correct posts and comments after sending')),
+array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')),
array('richtext', t('Richtext Editor'), t('Use richtext/visual editor where applicable')),
);
diff --git a/install/htconfig.sample.php b/install/htconfig.sample.php
index 5c4403492..47dcb7e12 100644
--- a/install/htconfig.sample.php
+++ b/install/htconfig.sample.php
@@ -38,7 +38,7 @@ $a->config['sitename'] = "Friendica Social Network";
$a->config['system']['register_policy'] = REGISTER_OPEN;
$a->config['register_text'] = '';
-$a->config[system']['admin_email'] = '';
+$a->config['system']['admin_email'] = '';
// Maximum size of an imported message, 0 is unlimited
@@ -55,40 +55,20 @@ $a->config['php_path'] = 'php';
// You shouldn't need to change anything else.
// Location of global directory submission page.
-$a->config['system']['directory_submit_url'] = 'http://dir.friendika.com/submit';
-$a->config['system']['directory_search_url'] = 'http://dir.friendika.com/directory?search=';
+$a->config['system']['directory_submit_url'] = 'http://dir.friendica.com/submit';
+$a->config['system']['directory_search_url'] = 'http://dir.friendica.com/directory?search=';
// PuSH - aka pubsubhubbub URL. This makes delivery of public posts as fast as private posts
$a->config['system']['huburl'] = 'http://pubsubhubbub.appspot.com';
-// Server-to-server private message encryption (RINO) is allowed by default.
-// Encryption will only be provided if this setting is true and the
-// PHP mcrypt extension is installed on both systems
-
-$a->config['system']['rino_encrypt'] = true;
-
// allowed themes (change this from admin panel after installation)
-$a->config['system']['allowed_themes'] = 'dispy,quattro,vier,darkzero,duepuntozero,greenzero,purplezero,slackr,diabook';
+$a->config['system']['allowed_themes'] = 'duepuntozero';
// default system theme
$a->config['system']['theme'] = 'duepuntozero';
-// By default allow pseudonyms
-
-$a->config['system']['no_regfullname'] = true;
-
-// If set to true the priority settings of ostatus contacts are used
-$a->config['system']['ostatus_use_priority'] = false;
-
-// If enabled, all items are cached in the given directory
-$a->config['system']['itemcache'] = "";
-
-// If enabled, the lockpath is used for a lockfile to check if the poller is running
-$a->config['system']['lockpath'] = "";
-// If enabled, the MyBB fulltext engine is used
-// $a->config['system']['use_fulltext_engine'] = true;
diff --git a/mod/settings.php b/mod/settings.php
index e275ae9f5..e8241f397 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -45,23 +45,18 @@ function settings_init(&$a) {
),
array(
+ 'label' => t('Feature settings'),
+ 'url' => $a->get_baseurl(true).'/settings/featured',
+ 'selected' => ((argv(1) === 'addon') ? 'active' : ''),
+ ),
+
+ array(
'label' => t('Display settings'),
'url' => $a->get_baseurl(true).'/settings/display',
'selected' => ((argv(1) === 'display') ? 'active' : ''),
),
array(
- 'label' => t('Connector settings'),
- 'url' => $a->get_baseurl(true).'/settings/connectors',
- 'selected' => ((argv(1) === 'connectors') ? 'active' : ''),
- ),
-
- array(
- 'label' => t('Plugin settings'),
- 'url' => $a->get_baseurl(true).'/settings/addon',
- 'selected' => ((argv(1) === 'addon') ? 'active' : ''),
- ),
- array(
'label' => t('Connected apps'),
'url' => $a->get_baseurl(true) . '/settings/oauth',
'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
@@ -73,11 +68,6 @@ function settings_init(&$a) {
'selected' => ''
),
- array(
- 'label' => t('Remove account'),
- 'url' => $a->get_baseurl(true) . '/removeme',
- 'selected' => ''
- )
);
$tabtpl = get_markup_template("generic_links_widget.tpl");
@@ -162,10 +152,14 @@ function settings_post(&$a) {
return;
}
- if((argc() > 1) && (argv(1) == 'addon')) {
- check_form_security_token_redirectOnErr('/settings/addon', 'settings_addon');
-
- call_hooks('plugin_settings_post', $_POST);
+ if((argc() > 1) && (argv(1) == 'featured')) {
+ check_form_security_token_redirectOnErr('/settings/featured', 'settings_featured');
+
+
+
+
+
+ call_hooks('featured_settings_post', $_POST);
return;
}
@@ -181,14 +175,6 @@ function settings_post(&$a) {
return;
}
- if((argc() > 1) && (argv(1) == 'connectors')) {
-
- check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
-
- call_hooks('connector_settings_post', $_POST);
- return;
- }
-
if((argc() > 1) && (argv(1) == 'display')) {
check_form_security_token_redirectOnErr('/settings/display', 'settings_display');
@@ -234,45 +220,84 @@ function settings_post(&$a) {
return; // NOTREACHED
}
- check_form_security_token_redirectOnErr('/settings', 'settings');
+
+ if(argc() > 1 && argv(1) === 'account') {
+
+ check_form_security_token_redirectOnErr('/settings/account', 'settings_account');
- call_hooks('settings_post', $_POST);
+ call_hooks('settings_account', $_POST);
+
+ $errs = array();
- if((x($_POST,'npassword')) || (x($_POST,'confirm'))) {
+ if((x($_POST,'npassword')) || (x($_POST,'confirm'))) {
- $newpass = $_POST['npassword'];
- $confirm = $_POST['confirm'];
+ $newpass = $_POST['npassword'];
+ $confirm = $_POST['confirm'];
+
+ if($newpass != $confirm ) {
+ $errs[] = t('Passwords do not match. Password unchanged.');
+ }
- $err = false;
- if($newpass != $confirm ) {
- notice( t('Passwords do not match. Password unchanged.') . EOL);
- $err = true;
+ if((! x($newpass)) || (! x($confirm))) {
+ $errs[] = t('Empty passwords are not allowed. Password unchanged.');
+ }
+
+ if(! $errs) {
+ $salt = random_string(32);
+ $password_encoded = hash('whirlpool', $salt . $newpass);
+ $r = q("update account set account_salt = '%s', account_password = '%s'
+ where account_id = %d limit 1",
+ dbesc($salt),
+ dbesc($password_encoded),
+ intval(get_account_id())
+ );
+ if($r)
+ info( t('Password changed.') . EOL);
+ else
+ $errs[] = t('Password update failed. Please try again.');
+ }
}
- if((! x($newpass)) || (! x($confirm))) {
- notice( t('Empty passwords are not allowed. Password unchanged.') . EOL);
- $err = true;
+ if($errs) {
+ foreach($errs as $err)
+ notice($err . EOL);
+ $errs = array();
}
- if(! $err) {
-
- $salt = random_string(32);
- $password_encoded = hash('whirlpool', $salt . $newpass);
- $r = q("update account set account_salt = '%s', account_password = '%s' where account_id = %d limit 1",
- dbesc($salt),
- dbesc($password_encoded),
- intval(get_account_id())
- );
- if($r)
- info( t('Password changed.') . EOL);
- else
- notice( t('Password update failed. Please try again.') . EOL);
+ $email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : '');
+ if($email != $account['account_email']) {
+ $account = $a->get_account();
+ if(! valid_email($email))
+ $errs[] = t('Not valid email.');
+ $adm = trim(get_config('system','admin_email'));
+ if(($adm) && (strcasecmp($email,$adm) == 0)) {
+ $errs[] = t('Protected email. Cannot change to that email.');
+ $email = $a->user['email'];
+ }
+ if(! $errs) {
+ $r = q("update account set account_email = '%s' where account_id = %d limit 1",
+ dbesc($email),
+ intval($account['account_id'])
+ );
+ if(! $r)
+ $errs[] = t('System failure storing new email. Please try again.');
+ }
}
+
+ if($errs) {
+ foreach($errs as $err)
+ notice($err . EOL);
+ }
+ goaway($a->get_baseurl(true) . '/settings/account' );
}
+
+ check_form_security_token_redirectOnErr('/settings', 'settings');
+
+ call_hooks('settings_post', $_POST);
+
$username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : '');
- $email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : '');
$timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : '');
$defloc = ((x($_POST,'defloc')) ? notags(trim($_POST['defloc'])) : '');
$openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
@@ -338,7 +363,6 @@ function settings_post(&$a) {
if(x($_POST,'notify8'))
$notify += intval($_POST['notify8']);
- $email_changed = false;
$err = '';
@@ -352,20 +376,6 @@ function settings_post(&$a) {
$err .= t(' Name too short.');
}
- if($email != $a->user['email']) {
- $email_changed = true;
- if(! valid_email($email))
- $err .= t(' Not valid email.');
- if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0)) {
- $err .= t(' Cannot change to that email.');
- $email = $a->user['email'];
- }
- }
-
- if(strlen($err)) {
- notice($err . EOL);
- return;
- }
if($timezone != $a->user['timezone']) {
if(strlen($timezone))
@@ -610,6 +620,37 @@ function settings_content(&$a) {
}
+ /*
+ * ACCOUNT SETTINGS
+ */
+
+
+ if((argc() > 1) && (argv(1) === 'account')) {
+ $account_settings = "";
+
+ call_hooks('account_settings', $account_settings);
+
+ $email = $a->account['account_email'];
+
+
+ $tpl = get_markup_template("settings_account.tpl");
+ $o .= replace_macros($tpl, array(
+ '$form_security_token' => get_form_security_token("settings_account"),
+ '$title' => t('Account Settings'),
+ '$h_pass' => t('Password Settings'),
+ '$password1'=> array('npassword', t('New Password:'), '', ''),
+ '$password2'=> array('confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')),
+ '$submit' => t('Submit'),
+ '$email' => array('email', t('Email Address:'), $email, ''),
+ '$removeme' => t('Remove Account'),
+ '$permanent' => t('Warning: This action is permanent and cannot be reversed.'),
+ '$account_settings' => $account_settings
+ ));
+ return $o;
+ }
+
+
+
if((argc() > 1) && (argv(1) === 'features')) {
$arr = array();
@@ -734,11 +775,6 @@ function settings_content(&$a) {
}
- /*
- * ACCOUNT SETTINGS
- */
-
-
@@ -791,7 +827,6 @@ function settings_content(&$a) {
$username = $channel['channel_name'];
- $email = $a->account['account_email'];
$nickname = $channel['channel_address'];
$timezone = $channel['channel_timezone'];
$notify = $channel['channel_notifyflags'];
@@ -917,7 +952,7 @@ function settings_content(&$a) {
$tpl_addr = get_markup_template("settings_nick_set.tpl");
$prof_addr = replace_macros($tpl_addr,array(
- '$desc' => t('Your webbie (web-id) is'),
+ '$desc' => t('Your channel address (or "webbie") is'),
'$nickname' => $nickname,
'$subdir' => $subdir,
'$basepath' => $a->get_hostname()
@@ -954,9 +989,6 @@ function settings_content(&$a) {
'$form_security_token' => get_form_security_token("settings"),
'$nickname_block' => $prof_addr,
- '$h_pass' => t('Password Settings'),
- '$password1'=> array('npassword', t('New Password:'), '', ''),
- '$password2'=> array('confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')),
'$h_basic' => t('Basic Settings'),
'$username' => array('username', t('Full Name:'), $username,''),
diff --git a/view/css/mod_settings.css b/view/css/mod_settings.css
index 3d78124fe..0532268f1 100644
--- a/view/css/mod_settings.css
+++ b/view/css/mod_settings.css
@@ -3,6 +3,13 @@
}
#settings-permissions-wrapper .field label{
width: 350px;
- font-weight: bold;
}
+.settings-submit-wrapper {
+ margin-bottom: 10px;
+}
+
+#settings-remove-account-link {
+ margin-top: 15px;
+ margin-bottom: 45px;
+}
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index a759e356a..48b3cffe7 100644
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -5,21 +5,9 @@ $nickname_block
<form action="settings" id="settings-form" method="post" autocomplete="off" >
<input type='hidden' name='form_security_token' value='$form_security_token'>
-<h3 class="settings-heading">$h_pass</h3>
-
-{{inc field_password.tpl with $field=$password1 }}{{endinc}}
-{{inc field_password.tpl with $field=$password2 }}{{endinc}}
-
-
-<div class="settings-submit-wrapper" >
-<input type="submit" name="submit" class="settings-submit" value="$submit" />
-</div>
-
-
<h3 class="settings-heading">$h_basic</h3>
{{inc field_input.tpl with $field=$username }}{{endinc}}
-{{inc field_input.tpl with $field=$email }}{{endinc}}
{{inc field_custom.tpl with $field=$timezone }}{{endinc}}
{{inc field_input.tpl with $field=$defloc }}{{endinc}}
{{inc field_checkbox.tpl with $field=$allowloc }}{{endinc}}
@@ -50,25 +38,14 @@ $nickname_block
-
-{{inc field_input.tpl with $field=$maxreq }}{{endinc}}
-
$profile_in_dir
-$profile_in_net_dir
-
-$hide_friends
-
-$hide_wall
-
-$blockwall
-
$blocktags
$suggestme
-$unkmail
+{{inc field_input.tpl with $field=$maxreq }}{{endinc}}
{{inc field_input.tpl with $field=$cntunkmail }}{{endinc}}
diff --git a/view/tpl/settings_account.tpl b/view/tpl/settings_account.tpl
new file mode 100644
index 000000000..d1a635f91
--- /dev/null
+++ b/view/tpl/settings_account.tpl
@@ -0,0 +1,28 @@
+<h1>$title</h1>
+
+
+<div id="settings-remove-account-link">
+<a href="removeme" title="$permanent" >$removeme</a>
+</div>
+
+
+<form action="settings/account" id="settings-account-form" method="post" autocomplete="off" >
+<input type='hidden' name='form_security_token' value='$form_security_token'>
+
+{{inc field_input.tpl with $field=$email }}{{endinc}}
+
+
+<h3 class="settings-heading">$h_pass</h3>
+
+{{inc field_password.tpl with $field=$password1 }}{{endinc}}
+{{inc field_password.tpl with $field=$password2 }}{{endinc}}
+
+
+<div class="settings-submit-wrapper" >
+<input type="submit" name="submit" class="settings-submit" value="$submit" />
+</div>
+
+$account_settings
+
+
+