From 303324cdff3f7c8bc83fae89256a2133939944b2 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 12 Dec 2013 02:15:02 -0800 Subject: more htmlspecialchars sanitisation --- include/taxonomy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/taxonomy.php') diff --git a/include/taxonomy.php b/include/taxonomy.php index 5159dad02..65d082bb0 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -87,9 +87,9 @@ function format_term_for_display($term) { return $s; if($term['url']) - $s .= '' . htmlspecialchars($term['term']) . ''; + $s .= '' . htmlspecialchars($term['term'], ENT_COMPAT,'UTF-8') . ''; else - $s .= htmlspecialchars($term['term']); + $s .= htmlspecialchars($term['term'], ENT_COMPAT,'UTF-8'); return $s; } -- cgit v1.2.3 From aa312f72bf48f3ffeb62606541b39e5243ce819e Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 20 Dec 2013 12:43:04 -0800 Subject: comanchify mod_directory. Two modules remaining. Actually three because message needs to be split. --- include/taxonomy.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'include/taxonomy.php') diff --git a/include/taxonomy.php b/include/taxonomy.php index 65d082bb0..7887f7687 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -217,16 +217,19 @@ function tagblock($link,$uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$ } function dir_tagblock($link,$r) { - $o = ''; - $tab = 0; + $o = ''; + $tab = 0; - if($r) { - $o = '

' . t('Keywords') . '

'; - foreach($r as $rr) { - $o .= ''.$rr['term'].' ' . "\r\n"; + if(! $r) + $r = get_app()->data['directory_keywords']; + + if($r) { + $o = '

' . t('Keywords') . '

'; + foreach($r as $rr) { + $o .= ''.$rr['term'].' ' . "\r\n"; + } + $o .= '
'; } - $o .= '
'; - } return $o; } -- cgit v1.2.3 From 22f614feba8502a5fd040cc34dab2baa3087da3c Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 28 Dec 2013 17:04:23 -0800 Subject: a bit more backend work on things --- include/taxonomy.php | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'include/taxonomy.php') diff --git a/include/taxonomy.php b/include/taxonomy.php index 7887f7687..065f904fc 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -270,4 +270,72 @@ function obj_verb_selector() { $o .= ''; return $o; +} + +function get_things($profile_hash,$uid) { + + $sql_extra = (($profile_hash) ? " and obj_page = '" . $profile_hash . "' " : ''); + + $r = q("select * from obj left join term on obj_obj = term_hash where term_hash != '' and uid = %d and obj_type = %d $sql_extra order by obj_verb, term", + intval($uid), + intval(TERM_OBJ_THING) + ); + + + $things = $sorted_things = null; + + $profile_hashes = array(); + + if($r) { + + // if no profile_hash was specified (display on profile page mode), match each of the things to a profile name + // (list all my things mode). This is harder than it sounds. + + foreach($r as $rr) { + $rr['profile_name'] = ''; + if(! in_array($rr['term_hash'],$profile_hashes)) + $profile_hashes[] = $rr['term_hash']; + } + stringify_array_elms($profile_hashes); + if(! $profile_hash) { + $exp = explode(',',$profile_hashes); + $p = q("select profile_guid as hash, profile_name as name from profile where profile_guid in ( $exp ) "); + if($p) { + foreach($r as $rr) { + foreach($p as $pp) { + if($rr['obj_page'] == $pp['hash']) { + $rr['profile_name'] == $pp['name']; + } + } + } + } + } + + $things = array(); + + // Use the system obj_verbs array as a sort key, since we don't really + // want an alphabetic sort. To change the order, use a plugin to + // alter the obj_verbs() array or alter it in code. Unknown verbs come + // after the known ones - in no particular order. + + $v = obj_verbs(); + foreach($v as $k => $foo) + $things[$k] = null; + foreach($r as $rr) { + if(! $things[$rr['obj_verb']]) + $things[$rr['obj_verb']] = array(); + $things[$rr['obj_verb']][] = array('term' => $rr['term'],'url' => $rr['url'],'img' => $rr['imgurl'], 'profile' => $rr['profile_name']); + } + $sorted_things = array(); + if($things) { + foreach($things as $k => $v) { + if(is_array($things[$k])) { + $sorted_things[$k] = $v; + } + } + } + } + + return $sorted_things; + } \ No newline at end of file -- cgit v1.2.3 From f36be066af66e4e21913de3e8b4da0c7a05349b1 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 29 Dec 2013 00:51:27 -0800 Subject: display_thing: it ain't much, but it's implemented. --- include/taxonomy.php | 1 - 1 file changed, 1 deletion(-) (limited to 'include/taxonomy.php') diff --git a/include/taxonomy.php b/include/taxonomy.php index 065f904fc..67263100f 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -281,7 +281,6 @@ function get_things($profile_hash,$uid) { intval(TERM_OBJ_THING) ); - $things = $sorted_things = null; $profile_hashes = array(); -- cgit v1.2.3 From 0dd7d936744cccfac4228cabecddc59ce05eb26c Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Dec 2013 04:25:55 -0800 Subject: basic edit and delete for things --- include/taxonomy.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/taxonomy.php') diff --git a/include/taxonomy.php b/include/taxonomy.php index 67263100f..4f2b5e8fd 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -261,11 +261,12 @@ function obj_verbs() { } -function obj_verb_selector() { +function obj_verb_selector($current = '') { $verbs = obj_verbs(); $o .= ''; return $o; -- cgit v1.2.3