Merge branch 'master' into zapp

This commit is contained in:
zotlabs 2018-06-04 17:47:34 -07:00
commit 9232351cb2
3 changed files with 35 additions and 18 deletions

View file

@ -69,7 +69,7 @@ class Activity_filter {
'icon' => 'users',
'url' => '#',
'sel' => (($filter_active == 'group') ? true : false),
'title' => sprintf(t('Show posts that I have filed to %s'), $t['term']),
'title' => t('Show my privacy groups'),
'sub' => $gsub
];
@ -93,16 +93,17 @@ class Activity_filter {
'icon' => '',
'url' => z_root() . '/' . $cmd . '/?f=&file=' . $t['term'],
'sel' => $file_active,
'title' => ''
'title' => sprintf(t('Show posts that I have filed to %s'), $t['term']),
];
}
$tabs[] = [
'id' => 'saved_folders',
'label' => t('Saved Folders'),
'icon' => 'folder',
'url' => '#',
'sel' => (($filter_active == 'file') ? true : false),
'title' => sprintf(t('Show posts that I have filed to %s'), $t['term']),
'title' => t('Show filed post categories'),
'sub' => $tsub
];
@ -123,17 +124,18 @@ class Activity_filter {
'img' => $f['xchan_photo_s'],
'url' => (($f['private_forum']) ? $f['xchan_url'] : z_root() . '/' . $cmd . '/?f=&pf=1&cid=' . $f['abook_id']),
'sel' => $forum_active,
'title' => t('Private forum'),
'title' => t('Show posts to this forum'),
'lock' => (($f['private_forum']) ? 'lock' : '')
];
}
$tabs[] = [
'id' => 'forums',
'label' => t('Forums'),
'icon' => 'comments-o',
'url' => '#',
'sel' => (($filter_active == 'forums') ? true : false),
'title' => t('Show this forums posts'),
'title' => t('Show forums'),
'sub' => $fsub
];

View file

@ -1325,20 +1325,23 @@ function sync_files($channel, $files) {
);
if($exists) {
if(! dbesc_array($p))
continue;
$str = '';
foreach($p as $k => $v) {
$matches = false;
if(preg_match('/([^a-zA-Z0-9\-\_\.])/',$k,$matches)) {
continue;
}
if($str)
$str .= ",";
$str .= " " . TQUOT . $k . TQUOT . " = '" . $v . "' ";
$str .= " " . TQUOT . $k . TQUOT . " = '" . (($k === 'content') ? dbescbin($v) : dbesc($v)) . "' ";
}
$r = dbq("update photo set " . $str . " where id = " . intval($exists[0]['id']) );
}
else {
create_table_from_array('photo',$p);
create_table_from_array('photo',$p, [ 'content' ] );
}
}
}

View file

@ -3186,21 +3186,33 @@ function array2XML($obj, $array) {
*
* @param string $table
* @param array $arr
* @param array $binary_fields - fields which will be cleansed with dbescbin rather than dbesc; this is critical for postgres
* @return boolean|PDOStatement
*/
function create_table_from_array($table, $arr) {
function create_table_from_array($table, $arr, $binary_fields = []) {
if(! ($arr && $table))
return false;
if(dbesc_array($arr)) {
$r = dbq("INSERT INTO " . TQUOT . $table . TQUOT . " (" . TQUOT
. implode(TQUOT . ', ' . TQUOT, array_keys($arr))
. TQUOT . ") VALUES ('"
. implode("', '", array_values($arr))
. "')"
);
$clean = [];
foreach($arr as $k => $v) {
$matches = false;
if(preg_match('/([^a-zA-Z0-9\-\_\.])/',$k,$matches)) {
return false;
}
if(in_array($k,$binary_fields)) {
$clean[$k] = dbescbin($v);
}
else {
$clean[$k] = dbesc($v);
}
}
$r = dbq("INSERT INTO " . TQUOT . $table . TQUOT . " (" . TQUOT
. implode(TQUOT . ', ' . TQUOT, array_keys($clean))
. TQUOT . ") VALUES ('"
. implode("', '", array_values($clean))
. "')"
);
return $r;
}