Merge remote-tracking branch 'upstream/dev' into wiki
This commit is contained in:
@@ -493,7 +493,7 @@ function bb_code($match) {
|
||||
|
||||
function bb_highlight($match) {
|
||||
if(in_array(strtolower($match[1]),['php','css','mysql','sql','abap','diff','html','perl','ruby',
|
||||
'vbscript','avrc','dtd','java','xml','cpp','python','javascript','js','sh']))
|
||||
'vbscript','avrc','dtd','java','xml','cpp','python','javascript','js','json','sh']))
|
||||
return text_highlight($match[2],strtolower($match[1]));
|
||||
return $match[0];
|
||||
}
|
||||
|
||||
@@ -1224,6 +1224,7 @@ function advanced_profile(&$a) {
|
||||
|
||||
$things = get_things(App::$profile['profile_guid'],App::$profile['profile_uid']);
|
||||
|
||||
|
||||
// logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA);
|
||||
|
||||
return replace_macros($tpl, array(
|
||||
|
||||
@@ -17,7 +17,7 @@ function group_add($uid,$name,$public = 0) {
|
||||
$z = q("SELECT * FROM `groups` WHERE `id` = %d LIMIT 1",
|
||||
intval($r)
|
||||
);
|
||||
if(count($z) && $z[0]['deleted']) {
|
||||
if(($z) && $z[0]['deleted']) {
|
||||
/*$r = q("UPDATE `groups` SET `deleted` = 0 WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
|
||||
intval($uid),
|
||||
dbesc($name)
|
||||
@@ -129,7 +129,7 @@ function group_byname($uid,$name) {
|
||||
intval($uid),
|
||||
dbesc($name)
|
||||
);
|
||||
if(count($r))
|
||||
if($r)
|
||||
return $r[0]['id'];
|
||||
return false;
|
||||
}
|
||||
@@ -178,11 +178,11 @@ function group_add_member($uid,$name,$member,$gid = 0) {
|
||||
intval($gid),
|
||||
dbesc($member)
|
||||
);
|
||||
if(count($r))
|
||||
if($r)
|
||||
return true; // You might question this, but
|
||||
// we indicate success because the group member was in fact created
|
||||
// -- It was just created at another time
|
||||
if(! count($r))
|
||||
if(! $r)
|
||||
$r = q("INSERT INTO `group_member` (`uid`, `gid`, `xchan`)
|
||||
VALUES( %d, %d, '%s' ) ",
|
||||
intval($uid),
|
||||
@@ -205,7 +205,7 @@ function group_get_members($gid) {
|
||||
intval(local_channel()),
|
||||
intval(local_channel())
|
||||
);
|
||||
if(count($r))
|
||||
if($r)
|
||||
$ret = $r;
|
||||
}
|
||||
return $ret;
|
||||
@@ -218,7 +218,7 @@ function group_get_members_xchan($gid) {
|
||||
intval($gid),
|
||||
intval(local_channel())
|
||||
);
|
||||
if(count($r)) {
|
||||
if($r) {
|
||||
foreach($r as $rr) {
|
||||
$ret[] = $rr['xchan'];
|
||||
}
|
||||
@@ -236,7 +236,7 @@ function mini_group_select($uid,$group = '') {
|
||||
intval($uid)
|
||||
);
|
||||
$grps[] = array('name' => '', 'hash' => '0', 'selected' => '');
|
||||
if(count($r)) {
|
||||
if($r) {
|
||||
foreach($r as $rr) {
|
||||
$grps[] = array('name' => $rr['gname'], 'id' => $rr['hash'], 'selected' => (($group == $rr['hash']) ? 'true' : ''));
|
||||
}
|
||||
@@ -279,7 +279,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
|
||||
$member_of = groups_containing(local_channel(),$cid);
|
||||
}
|
||||
|
||||
if(count($r)) {
|
||||
if($r) {
|
||||
foreach($r as $rr) {
|
||||
$selected = (($group_id == $rr['id']) ? ' group-selected' : '');
|
||||
|
||||
@@ -356,7 +356,7 @@ function groups_containing($uid,$c) {
|
||||
);
|
||||
|
||||
$ret = array();
|
||||
if(count($r)) {
|
||||
if($r) {
|
||||
foreach($r as $rr)
|
||||
$ret[] = $rr['gid'];
|
||||
}
|
||||
|
||||
@@ -189,6 +189,10 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
|
||||
*/
|
||||
function z_post_url($url,$params, $redirects = 0, $opts = array()) {
|
||||
|
||||
// logger('url: ' . $url);
|
||||
// logger('params: ' . print_r($params,true));
|
||||
// logger('opts: ' . print_r($opts,true));
|
||||
|
||||
$ret = array('return_code' => 0, 'success' => false, 'header' => "", 'body' => "");
|
||||
|
||||
$ch = curl_init($url);
|
||||
@@ -214,14 +218,15 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
|
||||
|
||||
if(x($opts,'headers')) {
|
||||
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
|
||||
logger('headers: ' . print_r($opts['headers'],true) . 'redir: ' . $redirects);
|
||||
}
|
||||
|
||||
if(x($opts,'nobody'))
|
||||
@curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']);
|
||||
|
||||
if(x($opts,'custom'))
|
||||
if(x($opts,'custom')) {
|
||||
@curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $opts['custom']);
|
||||
@curl_setopt($ch, CURLOPT_POST,0);
|
||||
}
|
||||
|
||||
|
||||
if(x($opts,'timeout') && intval($opts['timeout'])) {
|
||||
|
||||
@@ -400,7 +400,7 @@ function get_things($profile_hash,$uid) {
|
||||
if(! $things[$rr['obj_verb']])
|
||||
$things[$rr['obj_verb']] = array();
|
||||
|
||||
$things[$rr['obj_verb']][] = array('term' => $rr['obj_term'],'url' => $rr['obj_url'],'img' => $rr['obj_imgurl'], 'profile' => $rr['profile_name'],'term_hash' => $rr['obj_obj'], 'likes' => $l,'like_count' => count($l),'like_label' => tt('Like','Likes',count($l),'noun'));
|
||||
$things[$rr['obj_verb']][] = array('term' => $rr['obj_term'],'url' => $rr['obj_url'],'img' => $rr['obj_imgurl'], 'editurl' => z_root() . '/thing/' . $rr['obj_obj'], 'profile' => $rr['profile_name'],'term_hash' => $rr['obj_obj'], 'likes' => $l,'like_count' => count($l),'like_label' => tt('Like','Likes',count($l),'noun'));
|
||||
}
|
||||
$sorted_things = array();
|
||||
if($things) {
|
||||
|
||||
@@ -2887,6 +2887,12 @@ function text_highlight($s,$lang) {
|
||||
if($lang === 'js')
|
||||
$lang = 'javascript';
|
||||
|
||||
if($lang === 'json') {
|
||||
$lang = 'javascript';
|
||||
if(! strpos(trim($s),"\n"))
|
||||
$s = jindent($s);
|
||||
}
|
||||
|
||||
if(! strpos('Text_Highlighter',get_include_path())) {
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . 'library/Text_Highlighter');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user