aboutsummaryrefslogtreecommitdiffstats
path: root/include/contact_widgets.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-07-09 22:08:25 -0700
committerfriendica <info@friendica.com>2012-07-09 22:08:25 -0700
commit4b066e04f619c2c6f8d383daee9ceab49f39acdc (patch)
treec9f3376ffce342333b60d848430ee13b3329d903 /include/contact_widgets.php
parent8855cb9c286eb66ad96b3388d85ccc57434a6db3 (diff)
downloadvolse-hubzilla-4b066e04f619c2c6f8d383daee9ceab49f39acdc.tar.gz
volse-hubzilla-4b066e04f619c2c6f8d383daee9ceab49f39acdc.tar.bz2
volse-hubzilla-4b066e04f619c2c6f8d383daee9ceab49f39acdc.zip
making tags work
Diffstat (limited to 'include/contact_widgets.php')
-rw-r--r--include/contact_widgets.php36
1 files changed, 15 insertions, 21 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index ce1cdbad5..ae88eefb4 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -77,21 +77,18 @@ function networks_widget($baseurl,$selected = '') {
function fileas_widget($baseurl,$selected = '') {
$a = get_app();
+
if(! local_user())
return '';
- $saved = get_pconfig(local_user(),'system','filetags');
- if(! strlen($saved))
- return;
-
- $matches = false;
$terms = array();
- $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
- if($cnt) {
- foreach($matches as $mtch) {
- $unescaped = xmlify(file_tag_decode($mtch[1]));
- $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
- }
+ $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
+ intval(local_user()),
+ intval(TERM_FILE)
+ );
+ if(count($r)) {
+ foreach($r as $rr)
+ $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
}
return replace_macros(get_markup_template('fileas_widget.tpl'),array(
@@ -108,18 +105,15 @@ function fileas_widget($baseurl,$selected = '') {
function categories_widget($baseurl,$selected = '') {
$a = get_app();
- $saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
- if(! strlen($saved))
- return;
- $matches = false;
$terms = array();
- $cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER);
- if($cnt) {
- foreach($matches as $mtch) {
- $unescaped = xmlify(file_tag_decode($mtch[1]));
- $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
- }
+ $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
+ intval($a->profile['profile_uid']),
+ intval(TERM_CATEGORY)
+ );
+ if(count($r)) {
+ foreach($r as $rr)
+ $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
}
return replace_macros(get_markup_template('categories_widget.tpl'),array(