<?php
-
+/**
+ * @file mod/settings.php
+ */
use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
+use Friendica\Database\DBM;
+use Friendica\Model\GlobalContact;
-require_once('include/group.php');
-require_once('include/socgraph.php');
+require_once 'include/group.php';
function get_theme_config_file($theme) {
$a = get_app();
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user())
);
- if (!dbm::is_result($r)) {
+ if (!DBM::is_result($r)) {
dba::insert('mailacct', array('uid' => local_user()));
}
if (strlen($mail_pass)) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user())
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
$eacct = $r[0];
require_once('include/email.php');
$mb = construct_mailbox_name($eacct);
$infinite_scroll = x($_POST, 'infinite_scroll') ? intval($_POST['infinite_scroll']) : 0;
$no_auto_update = x($_POST, 'no_auto_update') ? intval($_POST['no_auto_update']) : 0;
$bandwidth_saver = x($_POST, 'bandwidth_saver') ? intval($_POST['bandwidth_saver']) : 0;
+ $smart_threading = x($_POST, 'smart_threading') ? intval($_POST['smart_threading']) : 0;
$nowarn_insecure = x($_POST, 'nowarn_insecure') ? intval($_POST['nowarn_insecure']) : 0;
$browser_update = x($_POST, 'browser_update') ? intval($_POST['browser_update']) : 0;
if ($browser_update != -1) {
PConfig::set(local_user(), 'system', 'infinite_scroll' , $infinite_scroll);
PConfig::set(local_user(), 'system', 'no_auto_update' , $no_auto_update);
PConfig::set(local_user(), 'system', 'bandwidth_saver' , $bandwidth_saver);
+ PConfig::set(local_user(), 'system', 'smart_threading' , $smart_threading);
if ($theme == $a->user['theme']) {
// call theme_post only if theme has not been changed
check_form_security_token_redirectOnErr('/settings', 'settings');
if (x($_POST,'resend_relocate')) {
- Worker::add(PRIORITY_HIGH, 'notifier', 'relocate', local_user());
+ Worker::add(PRIORITY_HIGH, 'Notifier', 'relocate', local_user());
info(t("Relocate message has been send to your contacts"));
goaway('settings');
}
// Update global directory in background
$url = $_SESSION['my_url'];
if ($url && strlen(Config::get('system', 'directory'))) {
- Worker::add(PRIORITY_LOW, "directory", $url);
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
}
- Worker::add(PRIORITY_LOW, 'profile_update', local_user());
+ Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());
// Update the global contact for the user
- update_gcontact_for_user(local_user());
+ GlobalContact::updateForUser(local_user());
//$_SESSION['theme'] = $theme;
if ($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
dbesc($a->argv[3]),
local_user());
- if (!dbm::is_result($r)) {
+ if (!DBM::is_result($r)) {
notice(t("You can't edit this application."));
return;
}
return;
}
- /// @TODO validate result with dbm::is_result()
+ /// @TODO validate result with DBM::is_result()
$r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my
FROM clients
LEFT JOIN tokens ON clients.client_id=tokens.client_id
$settings_addons = "";
$r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
- if (!dbm::is_result($r)) {
+ if (!DBM::is_result($r)) {
$settings_addons = t('No Plugin settings configured');
}
$r = null;
}
- $mail_server = ((dbm::is_result($r)) ? $r[0]['server'] : '');
- $mail_port = ((dbm::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
- $mail_ssl = ((dbm::is_result($r)) ? $r[0]['ssltype'] : '');
- $mail_user = ((dbm::is_result($r)) ? $r[0]['user'] : '');
- $mail_replyto = ((dbm::is_result($r)) ? $r[0]['reply_to'] : '');
- $mail_pubmail = ((dbm::is_result($r)) ? $r[0]['pubmail'] : 0);
- $mail_action = ((dbm::is_result($r)) ? $r[0]['action'] : 0);
- $mail_movetofolder = ((dbm::is_result($r)) ? $r[0]['movetofolder'] : '');
- $mail_chk = ((dbm::is_result($r)) ? $r[0]['last_check'] : NULL_DATE);
+ $mail_server = ((DBM::is_result($r)) ? $r[0]['server'] : '');
+ $mail_port = ((DBM::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
+ $mail_ssl = ((DBM::is_result($r)) ? $r[0]['ssltype'] : '');
+ $mail_user = ((DBM::is_result($r)) ? $r[0]['user'] : '');
+ $mail_replyto = ((DBM::is_result($r)) ? $r[0]['reply_to'] : '');
+ $mail_pubmail = ((DBM::is_result($r)) ? $r[0]['pubmail'] : 0);
+ $mail_action = ((DBM::is_result($r)) ? $r[0]['action'] : 0);
+ $mail_movetofolder = ((DBM::is_result($r)) ? $r[0]['movetofolder'] : '');
+ $mail_chk = ((DBM::is_result($r)) ? $r[0]['last_check'] : NULL_DATE);
$tpl = get_markup_template("settings_connectors.tpl");
$is_experimental = file_exists('view/theme/' . $th . '/experimental');
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
$is_mobile = file_exists('view/theme/' . $th . '/mobile');
- if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || Config::get('experimentals', 'exp_themes')===false))) {
+ if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || is_null(Config::get('experimentals', 'exp_themes'))))) {
$theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
if ($is_mobile) {
$mobile_themes[$f]=$theme_name;
$itemspage_mobile_network = intval(PConfig::get(local_user(), 'system', 'itemspage_mobile_network'));
$itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items
- $nosmile = PConfig::get(local_user(), 'system', 'no_smilies');
- $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0
-
- $first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week');
- $first_day_of_week = (($first_day_of_week===false)? '0': $first_day_of_week); // default if not set: 0
+ $nosmile = PConfig::get(local_user(), 'system', 'no_smilies', 0);
+ $first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week', 0);
$weekdays = array(0 => t("Sunday"), 1 => t("Monday"));
- $noinfo = PConfig::get(local_user(), 'system', 'ignore_info');
- $noinfo = (($noinfo===false)? '0': $noinfo); // default if not set: 0
-
- $infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll');
- $infinite_scroll = (($infinite_scroll===false)? '0': $infinite_scroll); // default if not set: 0
-
- $no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update');
- $no_auto_update = (($no_auto_update===false)? '0': $no_auto_update); // default if not set: 0
-
- $bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver');
- $bandwidth_saver = (($bandwidth_saver === false) ? '0' : $bandwidth_saver); // default if not set: 0
+ $noinfo = PConfig::get(local_user(), 'system', 'ignore_info', 0);
+ $infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0);
+ $no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update', 0);
+ $bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver', 0);
+ $smart_threading = PConfig::get(local_user(), 'system', 'smart_threading', 0);
$theme_config = "";
if (($themeconfigfile = get_theme_config_file($theme_selected)) != null) {
'$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''),
'$no_auto_update' => array('no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, t('When disabled, the network page is updated all the time, which could be confusing while reading.')),
'$bandwidth_saver' => array('bandwidth_saver', t('Bandwith Saver Mode'), $bandwidth_saver, t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')),
+ '$smart_threading' => array('smart_threading', t('Smart Threading'), $smart_threading, t('When enabled, suppress extraneous thread indentation while keeping it where it matters. Only works if threading is available and enabled.')),
'$d_tset' => t('General Theme Settings'),
'$d_ctset' => t('Custom Theme Settings'),