From 5f84e3940d6a6ba8732104bf376921c061808f18 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 17 Jun 2013 20:16:50 -0700 Subject: much more efficient config functions. This will save potentially hundreds of DB lookups - still need to update the xconfig but want to give the others a good workout as it has been one of those days. --- mod/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index f417586af..a6d45e9b8 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -719,7 +719,6 @@ function settings_content(&$a) { if((argc() > 1) && (argv(1) === 'features')) { - $arr = array(); $features = get_features(); @@ -739,6 +738,7 @@ function settings_content(&$a) { '$submit' => t('Submit'), '$field_yesno' => 'field_yesno.tpl', )); + return $o; } -- cgit v1.2.3 From c0cc494bf36a61885bc3391e6f05b48baafb312a Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Jun 2013 02:06:16 -0700 Subject: fix mod-display when not logged in. --- mod/display.php | 4 ++-- mod/search.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/display.php b/mod/display.php index b1ae54df3..110dd1807 100644 --- a/mod/display.php +++ b/mod/display.php @@ -59,7 +59,7 @@ function display_content(&$a, $update = 0, $load = false) { $o .= '
' . "\r\n"; - $o .= "\r\n"; $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( @@ -152,7 +152,7 @@ function display_content(&$a, $update = 0, $load = false) { - $o .= conversation($a,$items,'display', $update, 'client'); + $o .= conversation($a, $items, 'display', $update, 'client'); if($updateable) { $x = q("UPDATE item SET item_flags = ( item_flags ^ %d ) diff --git a/mod/search.php b/mod/search.php index 4e093d865..3129e84b4 100644 --- a/mod/search.php +++ b/mod/search.php @@ -153,7 +153,7 @@ function search_content(&$a,$update = 0, $load = false) { // because browser prefetching might change it on us. We have to deliver it with the page. $o .= '' . "\r\n"; - $o .= "\r\n"; $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( -- cgit v1.2.3 From 2e7afa96f4018d63b35f276236cd60e25879fc53 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Jun 2013 19:15:33 -0700 Subject: map comment_policy on local post submission --- mod/item.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index ed5941d2a..338d2a2ee 100644 --- a/mod/item.php +++ b/mod/item.php @@ -532,6 +532,7 @@ function item_post(&$a) { $datarray['item_restrict'] = $item_restrict; $datarray['item_flags'] = $item_flags; + $datarray['comment_policy'] = map_scope($channel['channel_w_comment']); // preview mode - prepare the body for display and send it via json -- cgit v1.2.3 From 4f06905a186252327e7446b8767889dc37aff9fc Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Jun 2013 18:06:14 -0700 Subject: infrastructure for future stuff --- mod/like.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/like.php b/mod/like.php index bf707477c..f617391a1 100755 --- a/mod/like.php +++ b/mod/like.php @@ -102,8 +102,7 @@ function like_content(&$a) { $post_type = (($item['resource_type'] === 'photo') ? $t('photo') : t('status')); - $links = array(array('rel' => 'alternate','type' => 'text/html', - 'href' => z_root() . '/display/' . $item['mid'])); + $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink'])); $objtype = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE ); $body = $item['body']; -- cgit v1.2.3 From 3b1e5e5204d7cade3afc320cc45b1eb4efa6743c Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Jun 2013 21:50:14 -0700 Subject: source code re-org, move taxonomy to separate include --- mod/editpost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/editpost.php b/mod/editpost.php index b28e58348..af6f741c6 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -85,7 +85,7 @@ function editpost_content(&$a) { '$jotnets' => $jotnets, '$title' => htmlspecialchars($itm[0]['title']), '$placeholdertitle' => t('Set title'), - '$category' => file_tag_file_to_list($itm[0]['file'], 'category'), + '$category' => '', // FIXME '$placeholdercategory' => t('Categories (comma-separated list)'), '$emtitle' => t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, -- cgit v1.2.3 From e25a38788705310787df4115a14cf97bb4131145 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Jun 2013 22:29:32 -0700 Subject: more issues related to Tony's re-install --- mod/chanview.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/chanview.php b/mod/chanview.php index 8de59b92e..4f7638846 100644 --- a/mod/chanview.php +++ b/mod/chanview.php @@ -29,7 +29,11 @@ function chanview_content(&$a) { ); } elseif($_REQUEST['url']) { - $r = q("select * from xchan where xchan_url = '%s' limit 1", + + // if somebody re-installed they will have more than one xchan, use the most recent name date as this is + // the most useful consistently ascending table item we have. + + $r = q("select * from xchan where xchan_url = '%s' order by xchan_name_date desc limit 1", dbesc($_REQUEST['url']) ); } -- cgit v1.2.3 From dd9d32bcb3dc8ab8a4cf0c9658f01dfba24f7db4 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 20 Jun 2013 17:09:11 -0700 Subject: make tag searches work at least as well as the normal search - which still is quite broken, but at least return some results without introducing too many security holes --- mod/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/search.php b/mod/search.php index 3129e84b4..02a845826 100644 --- a/mod/search.php +++ b/mod/search.php @@ -171,7 +171,7 @@ function search_content(&$a,$update = 0, $load = false) { '$nouveau' => '0', '$wall' => '0', '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), - '$search' => (($tag) ? '#' : '') . $search, + '$search' => (($tag) ? urlencode('#') : '') . $search, '$order' => '', '$file' => '', '$cats' => '', -- cgit v1.2.3 From 61601dc23d3e8305720bfc4e4e6b6dbd7b85f546 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 20 Jun 2013 18:36:02 -0700 Subject: Add site registration policy to site record. This is not yet used or stored, but potentially can be exchanged through directory mirrors to automatically create "open site" lists. --- mod/zfinger.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/zfinger.php b/mod/zfinger.php index 48582b3d6..460f157b6 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -181,7 +181,14 @@ function zfinger_init(&$a) { $ret['site']['directory_mode'] = 'standalone'; if($dirmode != DIRECTORY_MODE_NORMAL) $ret['site']['directory_url'] = z_root() . '/dirsearch'; - + $register_policy = intval(get_config('system','register_policy')); + if($register_policy == REGISTER_CLOSED) + $ret['site']['register_policy'] = 'closed'; + if($register_policy == REGISTER_APPROVE) + $ret['site']['register_policy'] = 'approve'; + if($register_policy == REGISTER_OPEN) + $ret['site']['register_policy'] = 'open'; + json_return_and_die($ret); } \ No newline at end of file -- cgit v1.2.3 From f835737cb7f8174b69145750be11fe4b896e8820 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 21 Jun 2013 21:36:48 -0700 Subject: fix some anomolies in config functions --- mod/admin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 670e89066..1fb729846 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -280,7 +280,7 @@ function admin_page_site_post(&$a){ set_config('system','delivery_interval',$delivery_interval); set_config('system','poll_interval',$poll_interval); set_config('system','maxloadavg',$maxloadavg); - set_config('config','sitename',$sitename); + set_config('system','sitename',$sitename); if ($banner=="") { del_config('system','banner'); @@ -402,7 +402,7 @@ function admin_page_site(&$a) { '$baseurl' => $a->get_baseurl(true), // name, label, value, help string, extra data... - '$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""), + '$sitename' => array('sitename', t("Site name"), htmlentities(get_config('system','sitename'), ENT_QUOTES), ""), '$banner' => array('banner', t("Banner/Logo"), $banner, ""), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), '$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - change theme settings"), $theme_choices), @@ -410,8 +410,8 @@ function admin_page_site(&$a) { '$theme_accessibility' => array('theme-accessibility', t("Accessibility system theme"), get_config('system','accessibility-theme'), t("Accessibility theme"), $theme_choices_accessibility), '$ssl_policy' => array('ssl_policy', t("SSL link policy"), (string) intval(get_config('system','ssl_policy')), t("Determines whether generated links should be forced to use SSL"), $ssl_choices), '$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")), - '$register_policy' => array('register_policy', t("Register policy"), $a->config['system']['register_policy'], "", $register_choices), - '$register_text' => array('register_text', t("Register text"), htmlentities($a->config['register_text'], ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")), + '$register_policy' => array('register_policy', t("Register policy"), get_config('system','register_policy'), "", $register_choices), + '$register_text' => array('register_text', t("Register text"), htmlentities(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")), '$abandon_days' => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')), '$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")), '$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")), -- cgit v1.2.3 From d093981d68477887f5aecbb988bebb451389b79e Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Jun 2013 04:51:27 -0700 Subject: another temporary fix to mod/search to only return one of each post. --- mod/search.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/search.php b/mod/search.php index 02a845826..1335ea508 100644 --- a/mod/search.php +++ b/mod/search.php @@ -189,7 +189,7 @@ function search_content(&$a,$update = 0, $load = false) { $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); dbg(1); if($load) { - $r = q("SELECT distinct(mid), item.* from item + $r = q("SELECT distinct mid, id as item_id from item WHERE item_restrict = 0 AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND item_private = 0 ) OR ( `item`.`uid` = %d )) @@ -209,15 +209,15 @@ dbg(0); if($r) { $parents_str = ids_to_querystr($r,'item_id'); - +dbg(1); $items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` WHERE item_restrict = 0 - $sql_extra ", - intval($a->profile['profile_uid']), - dbesc($parents_str) + $sql_extra and parent in ( $parents_str ) " +// intval($a->profile['profile_uid']), +// dbesc($parents_str) ); - +dbg(0); xchan_query($items); $items = fetch_post_tags($items,true); $items = conv_sort($items,'created'); -- cgit v1.2.3 From 57c7f725f67ac868b54d0dbff2d4fb0122af3954 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Jun 2013 18:15:17 -0700 Subject: begin code to sync channel changes across all channel clones. --- mod/settings.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index a6d45e9b8..788514eca 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -1,5 +1,7 @@ user) && x($a->user,'uid') && $a->user['uid'] != local_user()) { -// notice( t('Permission denied.') . EOL); -// return; -// } - - $old_page_flags = $a->user['page-flags']; - if((argc() > 1) && (argv(1) === 'oauth') && x($_POST,'remove')){ check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth'); @@ -292,7 +287,7 @@ function settings_post(&$a) { $errs[] = t('Not valid email.'); $adm = trim(get_config('system','admin_email')); if(($adm) && (strcasecmp($email,$adm) == 0)) { - $errs[] = t('Protected email. Cannot change to that email.'); + $errs[] = t('Protected email address. Cannot change to that email.'); $email = $a->user['email']; } if(! $errs) { -- cgit v1.2.3 From 156cf592eeeaf1ef2fe446655b1f28debab7814c Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Jun 2013 14:28:11 -0700 Subject: more nomadic clone sync --- mod/connections.php | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index ff3edfeaa..226c1678f 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -126,13 +126,27 @@ function connections_post(&$a) { intval(local_user()), intval($contact_id) ); - if($r) + if($r) { $a->data['abook'] = $r[0]; + } + return; } +function connections_clone(&$a) { + + if(! array_key_exists('abook',$a->data)) + return; + $clone = $a->data['abook']; + + unset($clone['abook_id']); + unset($clone['abook_account']); + unset($clone['abook_channel']); + require_once('include/settings.php'); + build_sync_packet(array('abook' => array($clone))); +} function connections_content(&$a) { @@ -183,40 +197,48 @@ function connections_content(&$a) { } if($cmd === 'block') { - if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_BLOCKED)) + if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_BLOCKED)) { info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_BLOCKED) ? t('Channel has been unblocked') : t('Channel has been blocked')) . EOL ); + connections_clone($a); + } else notice(t('Unable to set address book parameters.') . EOL); goaway($a->get_baseurl(true) . '/connections/' . $contact_id); } if($cmd === 'ignore') { - if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_IGNORED)) + if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_IGNORED)) { info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_IGNORED) ? t('Channel has been unignored') : t('Channel has been ignored')) . EOL ); + connections_clone($a); + } else notice(t('Unable to set address book parameters.') . EOL); goaway($a->get_baseurl(true) . '/connections/' . $contact_id); } if($cmd === 'archive') { - if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_ARCHIVED)) + if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_ARCHIVED)) { info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? t('Channel has been unarchived') : t('Channel has been archived')) . EOL ); + connections_clone($a); + } else notice(t('Unable to set address book parameters.') . EOL); goaway($a->get_baseurl(true) . '/connections/' . $contact_id); } if($cmd === 'hide') { - if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_HIDDEN)) + if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_HIDDEN)) { info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_HIDDEN) ? t('Channel has been unhidden') : t('Channel has been hidden')) . EOL ); + connections_clone($a); + } else notice(t('Unable to set address book parameters.') . EOL); goaway($a->get_baseurl(true) . '/connections/' . $contact_id); @@ -226,10 +248,12 @@ function connections_content(&$a) { if($cmd === 'approve') { if($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) { - if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_PENDING)) + if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_PENDING)) { info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) ? t('Channel has been approved') : t('Channel has been unapproved')) . EOL ); + connections_clone($a); + } else notice(t('Unable to set address book parameters.') . EOL); } @@ -244,6 +268,7 @@ function connections_content(&$a) { // terminate_friendship($a->get_channel(),$orig_record[0]); contact_remove(local_user(), $orig_record[0]['abook_id']); +// FIXME - send to clones info( t('Contact has been removed.') . EOL ); if(x($_SESSION,'return_url')) goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); -- cgit v1.2.3 From b9466941e77eea806539ea56b6b625d354968f4c Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Jun 2013 17:31:02 -0700 Subject: more work on channel sync --- mod/connections.php | 2 +- mod/settings.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index 226c1678f..a53107dcf 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -145,7 +145,7 @@ function connections_clone(&$a) { unset($clone['abook_account']); unset($clone['abook_channel']); require_once('include/settings.php'); - build_sync_packet(array('abook' => array($clone))); + build_sync_packet(0 /* use the current local_user */, array('abook' => array($clone))); } diff --git a/mod/settings.php b/mod/settings.php index 788514eca..e830d7070 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -177,6 +177,7 @@ function settings_post(&$a) { check_form_security_token_redirectOnErr('/settings/featured', 'settings_featured'); call_hooks('feature_settings_post', $_POST); + build_sync_packet(); return; } @@ -189,6 +190,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'feature',substr($k,8),((intval($v)) ? 1 : 0)); } } + build_sync_packet(); return; } @@ -232,6 +234,7 @@ function settings_post(&$a) { ); call_hooks('display_settings_post', $_POST); + build_sync_packet(); goaway($a->get_baseurl(true) . '/settings/display' ); return; // NOTREACHED } @@ -545,11 +548,12 @@ function settings_post(&$a) { dbesc($username), intval($channel['channel_id']) ); - // we really need to send out notifications to all our friends } proc_run('php','include/directory.php',local_user()); + build_sync_packet(); + //$_SESSION['theme'] = $theme; if($email_changed && $a->config['system']['register_policy'] == REGISTER_VERIFY) { -- cgit v1.2.3 From 230aeb782eaea85626640d14f5949606de73d502 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Jun 2013 16:12:04 -0700 Subject: if you send a private post to an @-taggable channel (and nobody else), tag them. This sort of implements what Zottel was asking for - posting to a forum by posting only to the forum without having to tag it. Taggables are already highlighted in the ACL widget so as to avoid privacy surprises. Currently untested but shouldn't take much to get working if it isn't working already. --- mod/item.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index 338d2a2ee..3a1e4a95e 100644 --- a/mod/item.php +++ b/mod/item.php @@ -320,6 +320,18 @@ function item_post(&$a) { $body = fix_mce_lf($body); } + // If we're sending a private message with a single @-taggable channel as a recipient, @-tag it. + + if(substr_count($str_contact_allow,'<') == 1 && $str_group_allow == '' && str_contact_deny == '' && $str_group_deny == '') { + $x = q("select abook_id, abook_their_perms from abook where abook_xchan = '%s' and abook_channel = %d limit 1", + dbesc(str_replace(array('<','>'),array('',''),$str_contact_allow)), + intval($profile_uid) + ); + if($x && ($x[0]['abook_their_perms'] & PERMS_W_TAGWALL)) + $body .= "\n\n@group+" . $x[0]['abook_id'] . "\n"; + } + + /** * fix naked links by passing through a callback to see if this is a red site -- cgit v1.2.3 From cdc66da52fb985c33e27b955324dd977830a1d8c Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Jun 2013 19:35:59 -0700 Subject: Basic ability to create "things" --- mod/thing.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 mod/thing.php (limited to 'mod') diff --git a/mod/thing.php b/mod/thing.php new file mode 100644 index 000000000..723b069bc --- /dev/null +++ b/mod/thing.php @@ -0,0 +1,43 @@ +get_account(); + + $name = escape_tags($_REQUEST['term']); + $url = $_REQUEST['link']; + $photo = $_REQUEST['photo']; + + $hash = random_string(); + + + if(! $name) + return; + + $r = q("insert into term ( aid, uid, oid, otype, type, term, url, imgurl, term_hash ) + values( %d, %d, %d, %d, %d, '%s', '%s', '%s', '%s' ) ", + intval($account_id), + intval(local_user()), + 0, + TERM_OBJ_THING, + TERM_THING, + dbesc($name), + dbesc(($url) ? $url : z_root() . '/thing/' . $hash), + dbesc(($photo) ? $photo : ''), + dbesc($hash) + ); + +} + + +function thing_content(&$a) { + + + + +} -- cgit v1.2.3 From e84f44710a1f37b4344c495f3818fc68e0521e0d Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Jun 2013 20:28:55 -0700 Subject: testing autotag --- mod/item.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index 3a1e4a95e..e93b152cf 100644 --- a/mod/item.php +++ b/mod/item.php @@ -322,7 +322,8 @@ function item_post(&$a) { // If we're sending a private message with a single @-taggable channel as a recipient, @-tag it. - if(substr_count($str_contact_allow,'<') == 1 && $str_group_allow == '' && str_contact_deny == '' && $str_group_deny == '') { + if(substr_count($str_contact_allow,'<') == 1 && $str_group_allow == '' && $str_contact_deny == '' && $str_group_deny == '') { + logger('mod-item: autotag'); $x = q("select abook_id, abook_their_perms from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc(str_replace(array('<','>'),array('',''),$str_contact_allow)), intval($profile_uid) -- cgit v1.2.3 From ae8316a2ca023ab49275dd3671180bf0e067abab Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Jun 2013 20:49:45 -0700 Subject: autotag clean-up, mop up, and go home --- mod/item.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index e93b152cf..c504c77e1 100644 --- a/mod/item.php +++ b/mod/item.php @@ -140,7 +140,9 @@ function item_post(&$a) { } } - if($parent) logger('mod_item: item_post parent=' . $parent); + if($parent) { + logger('mod_item: item_post parent=' . $parent); + } $observer = $a->get_observer(); @@ -320,10 +322,9 @@ function item_post(&$a) { $body = fix_mce_lf($body); } - // If we're sending a private message with a single @-taggable channel as a recipient, @-tag it. + // If we're sending a private top-level message with a single @-taggable channel as a recipient, @-tag it. - if(substr_count($str_contact_allow,'<') == 1 && $str_group_allow == '' && $str_contact_deny == '' && $str_group_deny == '') { - logger('mod-item: autotag'); + if((! $parent) && (substr_count($str_contact_allow,'<') == 1) && ($str_group_allow == '') && ($str_contact_deny == '') && ($str_group_deny == '')) { $x = q("select abook_id, abook_their_perms from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc(str_replace(array('<','>'),array('',''),$str_contact_allow)), intval($profile_uid) -- cgit v1.2.3 From 6fba7ac1aff92e327357d21b00e8919e041d8395 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Jun 2013 21:40:56 -0700 Subject: fix cid query --- mod/network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/network.php b/mod/network.php index bbd9f9de7..aa134eece 100644 --- a/mod/network.php +++ b/mod/network.php @@ -465,7 +465,7 @@ function network_content(&$a, $update = 0, $load = false) { intval(local_user()) ); if($r) { - $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_user()) . " AND ( author_xchan = " . dbesc($r[0]['abook_xchan']) . " or owner_xchan = " . dbesc($r[0]['abook_xchan']) . " ) and item_restrict = 0 ) "; + $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_user()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) and item_restrict = 0 ) "; $o = '

' . t('Contact: ') . $r[0]['name'] . '

' . $o; } else { -- cgit v1.2.3 From 29502438f807275ab8ea8259ca261117e561c962 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 29 Jun 2013 21:27:01 -0700 Subject: partial implementation of issue #64 - local tag storage linked to the tagged item has been provided. tag deletion, comment tagging, and full testing of this feature are still outstanding. --- mod/tagger.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/tagger.php b/mod/tagger.php index 28e10d131..6ad026f62 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -122,6 +122,7 @@ function tagger_content(&$a) { $arr['object'] = $obj; $arr['parent_mid'] = $item['mid']; + store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_HASHTAG,$term); $ret = post_activity_item($arr); if($ret['success']) -- cgit v1.2.3 From 72f6edd59507797ef4073aed01ca1a0d14fa8cfd Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 30 Jun 2013 00:38:02 -0700 Subject: add age to directory profile - requires updating on each birthday and that part is still missing --- mod/zfinger.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mod') diff --git a/mod/zfinger.php b/mod/zfinger.php index 460f157b6..d438940a1 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -91,6 +91,9 @@ function zfinger_init(&$a) { $profile['birthday'] = $p[0]['dob']; if($profile['birthday'] != '0000-00-00') $profile['next_birthday'] = z_birthday($p[0]['dob'],$e['channel_timezone']); + + if($age = age($p[0]['dob'],$e['channel_timezone'],'')) + $profile['age'] = $age; $profile['gender'] = $p[0]['gender']; $profile['marital'] = $p[0]['marital']; $profile['sexual'] = $p[0]['sexual']; -- cgit v1.2.3 From 9bc5e05d3c7f614a402ea5e8cb1e1d641090f650 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 30 Jun 2013 00:49:53 -0700 Subject: age query in dirsearch --- mod/dirsearch.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mod') diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 5465e11ff..edcac9033 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -32,6 +32,8 @@ function dirsearch_content(&$a) { $gender = ((x($_REQUEST,'gender')) ? $_REQUEST['gender'] : ''); $marital = ((x($_REQUEST,'marital')) ? $_REQUEST['marital'] : ''); $keywords = ((x($_REQUEST,'keywords')) ? $_REQUEST['keywords'] : ''); + $agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 ); + $agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 ); // TODO - a meta search which joins all of these things to one search string @@ -58,6 +60,14 @@ function dirsearch_content(&$a) { if($keywords) $sql_extra .= " OR xprof_keywords like '" . protect_sprintf( '%' . dbesc($keywords) . '%' ) . "' "; + // we only support an age range currently. You must set both agege + // (greater than or equal) and agele (less than or equal) + + if($agele && $agege) { + $sql_extra .= " OR ( xprof_age <= " . intval($agele) . " "; + $sql_extra .= " AND xprof_age >= " . intval($agege) . ") "; + } + $perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 80); $page = (($_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0); $startrec = (($page+1) * $perpage) - $perpage; -- cgit v1.2.3 From 9fd4d5f0ccd6ed3f9d6ce79e3ad0b1b338b34b1b Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 30 Jun 2013 01:00:24 -0700 Subject: add age to dirsearch json --- mod/dirsearch.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/dirsearch.php b/mod/dirsearch.php index edcac9033..b2b28ce8c 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -134,6 +134,7 @@ function dirsearch_content(&$a) { $entry['postcode'] = $rr['xprof_postcode']; $entry['country'] = $rr['xprof_country']; $entry['birthday'] = $rr['xprof_dob']; + $entry['age'] = $rr['xprof_age']; $entry['gender'] = $rr['xprof_gender']; $entry['marital'] = $rr['xprof_marital']; $entry['keywords'] = $rr['xprof_keywords']; -- cgit v1.2.3 From 822a4a028718b81119ab51e47145b2ddf87b775c Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 30 Jun 2013 23:04:27 -0700 Subject: fix some community tagging bugs --- mod/tagger.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/tagger.php b/mod/tagger.php index 6ad026f62..ec5c92184 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -11,6 +11,8 @@ function tagger_content(&$a) { return; } + $observer_hash = get_observer_hash(); + $term = notags(trim($_GET['term'])); // no commas allowed $term = str_replace(array(',',' '),array('','_'),$term); @@ -121,8 +123,8 @@ function tagger_content(&$a) { $arr['obj_type'] = $objtype; $arr['object'] = $obj; $arr['parent_mid'] = $item['mid']; - - store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_HASHTAG,$term); + + store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_HASHTAG,$term,$tagid); $ret = post_activity_item($arr); if($ret['success']) -- cgit v1.2.3