$cmdline = implode($args, " ");
if (get_config('system', 'proc_windows')) {
- proc_close(proc_open('cmd /c start /b ' . $cmdline, array(), $foo, dirname(__FILE__)));
+ $resource = proc_open('cmd /c start /b ' . $cmdline, array(), $foo, dirname(__FILE__));
} else {
- proc_close(proc_open($cmdline . " &", array(), $foo, dirname(__FILE__)));
+ $resource = proc_open($cmdline . " &", array(), $foo, dirname(__FILE__));
}
-
+ if (!is_resource($resource)) {
+ logger('We got no resource for command '.$cmdline, LOGGER_DEBUG);
+ return;
+ }
+ proc_close($resource);
}
/**
//$a->config['system']['block_local_dir'] = false;
// Location of the global directory
-$a->config['system']['directory'] = 'http://dir.friendi.ca';
+$a->config['system']['directory'] = 'https://dir.friendica.social';
// Allowed protocols in link URLs; HTTP protocols always are accepted
$a->config['system']['allowed_link_protocols'] = array('ftp', 'ftps', 'mailto', 'cid', 'gopher');
function get_contact_details_by_url($url, $uid = -1, $default = array()) {
static $cache = array();
+ if ($url == '') {
+ return $default;
+ }
+
if ($uid == -1) {
$uid = local_user();
}
function get_contact_details_by_addr($addr, $uid = -1) {
static $cache = array();
+ if ($addr == '') {
+ return array();
+ }
+
if ($uid == -1) {
$uid = local_user();
}
$data = array();
$contact_id = 0;
+ if ($url == '') {
+ return 0;
+ }
+
// We first try the nurl (http://server.tld/nick), most common case
$contacts = q("SELECT `id`, `avatar-date` FROM `contact`
WHERE `nurl` = '%s'
// check if we have translations for the preferred languages and pick the 1st that has
for ($i=0; $i<count($lang_list); $i++) {
$lang = $lang_list[$i];
- if(file_exists("view/lang/$lang") && is_dir("view/lang/$lang")) {
+ if ($lang === 'en' || (file_exists("view/lang/$lang") && is_dir("view/lang/$lang"))) {
$preferred = $lang;
break;
}
if (this.element.val().indexOf( searchText) >= 0 ) {
return;
}
- this.element.val(searchText + this.element.val());
+ this.element.val(searchText + this.element.val()).trigger('change');
}
ACL.prototype.on_submit = function(){
if (word != null) {
var textBefore = text.value.substring(0, caretPos);
var textAfter = text.value.substring(caretPos, text.length);
- $('#' + id).val(textBefore + '\r\n[*] ' + textAfter);
+ $('#' + id).val(textBefore + '\r\n[*] ' + textAfter).trigger('change');
setCaretPosition(text, caretPos + 5);
return true;
}
var start = textarea.selectionStart;
var end = textarea.selectionEnd;
textarea.value = textarea.value.substring(0, start) + bbcode + textarea.value.substring(end, textarea.value.length);
+ $(textarea).trigger('change');
});
$force_ssl = ((x($_POST,'force_ssl')) ? True : False);
$hide_help = ((x($_POST,'hide_help')) ? True : False);
$suppress_tags = ((x($_POST,'suppress_tags')) ? True : False);
- $use_fulltext_engine = ((x($_POST,'use_fulltext_engine')) ? True : False);
$itemcache = ((x($_POST,'itemcache')) ? notags(trim($_POST['itemcache'])) : '');
$itemcache_duration = ((x($_POST,'itemcache_duration')) ? intval($_POST['itemcache_duration']) : 0);
$max_comments = ((x($_POST,'max_comments')) ? intval($_POST['max_comments']) : 0);
set_config('system', 'force_ssl', $force_ssl);
set_config('system', 'hide_help', $hide_help);
- set_config('system', 'use_fulltext_engine', $use_fulltext_engine);
set_config('system', 'itemcache', $itemcache);
set_config('system', 'itemcache_duration', $itemcache_duration);
set_config('system', 'max_comments', $max_comments);
'$nodeinfo' => array('nodeinfo', t("Publish server information"), get_config('system','nodeinfo'), t("If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See <a href='http://the-federation.info/'>the-federation.info</a> for details.")),
- '$use_fulltext_engine' => array('use_fulltext_engine', t("Use MySQL full text engine"), get_config('system','use_fulltext_engine'), t("Activates the full text engine. Speeds up search - but can only search for four and more characters.")),
'$suppress_tags' => array('suppress_tags', t("Suppress Tags"), get_config('system','suppress_tags'), t("Suppress showing a list of hashtags at the end of the posting.")),
'$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), t("The item caches buffers generated bbcode and external images.")),
'$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.")),
$sql_order = "`item`.`id`";
$order_mode = "id";
} else {
- // Disabled until final decision what to do with this
- //if (get_config('system','use_fulltext_engine'))
- // $sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
- //else
- $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
+ $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
$sql_order = "`item`.`id`";
$order_mode = "id";
}
'$item_link' => $it['link'],
'$item_image' => $it['image'],
'$item_url' => $it['url'],
- '$item_text' => htmlentities($it['text']),
+ '$item_text' => $it['text'],
'$item_when' => $it['when'],
'$item_ago' => $it['ago'],
'$item_seen' => $it['seen'],
} else {
logger("Start fulltext search for '".$search."'", LOGGER_DEBUG);
- // Disabled until finally is decided how to proceed with this
- //if (get_config('system','use_fulltext_engine')) {
- // $sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
- //} else {
- $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
- //}
+ $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
$r = q("SELECT %s
FROM `item` %s
<div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
<h3>{{$performance}}</h3>
- <!-- {{include file="field_checkbox.tpl" field=$use_fulltext_engine}} -->
{{include file="field_checkbox.tpl" field=$only_tag_search}}
{{include file="field_input.tpl" field=$itemcache}}
{{include file="field_input.tpl" field=$itemcache_duration}}
}
}
+ $(textarea).trigger('change');
+
return true;
}
});
+ /*
+ * This event handler hides all comment UI when the user clicks anywhere on the page
+ * It ensures that we aren't closing the current comment box
+ *
+ * We are making an exception for buttons because of a race condition with the
+ * comment opening button that results in an already closed comment UI.
+ */
+ $(document).on('click', function(event) {
+ if (event.target.type === 'button') {
+ return true;
+ }
+
+ var $dontclosethis = $(event.target).closest('.wall-item-comment-wrapper').find('.comment-edit-form');
+ $('.wall-item-comment-wrapper .comment-edit-submit-wrapper:visible').each(function() {
+ var $parent = $(this).parent('.comment-edit-form');
+ var itemId = $parent.data('itemId');
+
+ if ($dontclosethis[0] != $parent[0]) {
+ var textarea = $parent.find('textarea').get(0)
+
+ commentCloseUI(textarea, itemId);
+ }
+ });
+ });
+ /*
+ * This event listeners ensures that the textarea size is updated event if the
+ * value is changed externally (textcomplete, insertFormatting, fbrowser...)
+ */
+ $(document).on('change', 'textarea', function(event) {
+ autosize.update(event.target);
+ });
});
function openClose(theID) {
{{else}}
<div class="comment-wwedit-wrapper" id="comment-edit-wrapper-{{$id}}" style="display: block;">
{{/if}}
- <form class="comment-edit-form" style="display: block;" id="comment-edit-form-{{$id}}" action="item" method="post" onsubmit="post_comment({{$id}}); return false;">
+ <form class="comment-edit-form" style="display: block;" data-item-id="{{$id}}" id="comment-edit-form-{{$id}}" action="item" method="post" onsubmit="post_comment({{$id}}); return false;">
<input type="hidden" name="type" value="{{$type}}" />
<input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
<input type="hidden" name="parent" value="{{$parent}}" />
<input type="hidden" name="post_id_random" value="{{$rand_num}}" />
<div class="bb form-group">
- <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty form-control text-autosize" name="body" placeholder="{{$comment}}" onFocus="commentOpenUI(this,{{$id}});" onBlur="commentCloseUI(this,{{$id}});"></textarea>
+ <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty form-control text-autosize" name="body" placeholder="{{$comment}}" onFocus="commentOpenUI(this,{{$id}});"></textarea>
</div>
{{if $qcomment}}
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
{{include file="field_input.tpl" field=$basepath}}
<h3>{{$performance}}</h3>
- {{include file="field_checkbox.tpl" field=$use_fulltext_engine}}
{{include file="field_input.tpl" field=$itemcache}}
{{include file="field_input.tpl" field=$itemcache_duration}}