* Recursively prepare a thread for HTML
*/
-function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $collapse_all=false) {
+function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $thread_level=1) {
$result = array();
$wall_template = 'wall_thread.tpl';
} else {
$indent = 'comment';
// Collapse comments
- if(($nb_items > 2) || $collapse_all) {
+ if(($nb_items > 2) || ($thread_level > 2)) {
if($items_seen == 1) {
$firstcollapsed = true;
}
- if($collapse_all) {
+ if($thread_level > 2) {
if($items_seen == $nb_items)
$lastcollapsed = true;
}
}
$item_result['children'] = array();
- if(count($item['children'])) {
- $collapse_all_children = $collapse_all;
- if(!$toplevelpost && !$collapse_all)
- $collapse_all_children = true;
- $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $collapse_all_children);
+ // Show children of children only if enabled
+ if(count($item['children'])
+ && (($thread_level < 2) || get_config('system','thread_allow'))) {
+
+ $thread_level++;
+ $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $thread_level);
}
$item_result['private'] = $item['private'];
$item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
// array with html for each thread (parent+comments)
$threads = array();
$threadsid = -1;
-
+
if($items && count($items)) {
if($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
{
// Normal View
+
// Threaded comments, $thr_c is used for now since we don't know what other parts of friendica uses this function
// Better not rely on the new code for stuff we haven't examined yet
if($thr_c) {
}
}
- $threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $previewing);
+ $threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode, $profile_owner);
}
else {
$threads[$threadsid]['items'][] = $arr['output'];
}
+
}
}
}
$block_public = ((x($_POST,'block_public')) ? True : False);
$force_publish = ((x($_POST,'publish_all')) ? True : False);
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
+ $thread_allow = ((x($_POST,'thread_allow')) ? True : False);
$no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
$no_openid = !((x($_POST,'no_openid')) ? True : False);
$no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
} else {
set_config('system','directory_submit_url', $global_directory);
}
+ set_config('system','thread_allow', $thread_allow);
set_config('system','block_extended_register', $no_multi_reg);
set_config('system','no_openid', $no_openid);
'$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")),
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
'$global_directory' => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), t("URL to update the global directory. If this is not set, the global directory is completely unavailable to the application.")),
+ '$thread_allow' => array('thread_allow', t("Allow threaded items"), get_config('system','thread_allow'), t("Allow infinite level threading for items on this site.")),
'$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
'$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),
{{ inc field_checkbox.tpl with $field=$diaspora_enabled }}{{ endinc }}
{{ inc field_checkbox.tpl with $field=$dfrn_only }}{{ endinc }}
{{ inc field_input.tpl with $field=$global_directory }}{{ endinc }}
+ {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }}
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>