diff options
author | Thomas Willingham <founder@kakste.com> | 2013-07-02 18:36:39 +0100 |
---|---|---|
committer | Thomas Willingham <founder@kakste.com> | 2013-07-02 18:36:39 +0100 |
commit | d1cae2da2abc3a602f682114bc02cce08a7e7578 (patch) | |
tree | ef3147f9db85bdde8e26303971a40d86e10bb508 /mod | |
parent | 33696cc8392daeb08d011aa3b1209f3b121898ea (diff) | |
parent | b86253c655f974920c4d3de0915611a7e66c7336 (diff) | |
download | volse-hubzilla-d1cae2da2abc3a602f682114bc02cce08a7e7578.tar.gz volse-hubzilla-d1cae2da2abc3a602f682114bc02cce08a7e7578.tar.bz2 volse-hubzilla-d1cae2da2abc3a602f682114bc02cce08a7e7578.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod')
-rw-r--r-- | mod/admin.php | 8 | ||||
-rw-r--r-- | mod/chanview.php | 6 | ||||
-rw-r--r-- | mod/connections.php | 37 | ||||
-rw-r--r-- | mod/dirsearch.php | 11 | ||||
-rw-r--r-- | mod/display.php | 4 | ||||
-rw-r--r-- | mod/editpost.php | 2 | ||||
-rw-r--r-- | mod/item.php | 17 | ||||
-rwxr-xr-x | mod/like.php | 3 | ||||
-rw-r--r-- | mod/network.php | 2 | ||||
-rw-r--r-- | mod/search.php | 16 | ||||
-rw-r--r-- | mod/settings.php | 19 | ||||
-rw-r--r-- | mod/tagger.php | 5 | ||||
-rw-r--r-- | mod/thing.php | 43 | ||||
-rw-r--r-- | mod/zfinger.php | 12 |
14 files changed, 147 insertions, 38 deletions
diff --git a/mod/admin.php b/mod/admin.php index 20518dfc8..224a41867 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -281,7 +281,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'); @@ -405,7 +405,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 - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices), @@ -414,8 +414,8 @@ function admin_page_site(&$a) { '$site_channel' => array('site-channel', t("Channel to use for this website's static pages"), get_config('system','site-channel'), t("Site Channel")), '$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")), 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']) ); } diff --git a/mod/connections.php b/mod/connections.php index ff3edfeaa..a53107dcf 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(0 /* use the current local_user */, 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']); diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 5465e11ff..b2b28ce8c 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; @@ -124,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']; 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 .= '<div id="live-display"></div>' . "\r\n"; - $o .= "<script> var profile_uid = " . intval(local_user()) + $o .= "<script> var profile_uid = " . ((intval(local_user())) ? local_user() : (-1)) . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\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/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, diff --git a/mod/item.php b/mod/item.php index ed5941d2a..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,6 +322,18 @@ function item_post(&$a) { $body = fix_mce_lf($body); } + // If we're sending a private top-level message with a single @-taggable channel as a recipient, @-tag it. + + 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) + ); + 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 @@ -532,6 +546,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 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']; 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 = '<h2>' . t('Contact: ') . $r[0]['name'] . '</h2>' . $o; } else { diff --git a/mod/search.php b/mod/search.php index 4e093d865..1335ea508 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 .= '<div id="live-search"></div>' . "\r\n"; - $o .= "<script> var profile_uid = " . intval(local_user()) + $o .= "<script> var profile_uid = " . ((intval(local_user())) ? local_user() : (-1)) . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( @@ -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' => '', @@ -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'); diff --git a/mod/settings.php b/mod/settings.php index f417586af..e830d7070 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -1,5 +1,7 @@ <?php +require_once('include/settings.php'); + function get_theme_config_file($theme){ @@ -115,13 +117,6 @@ function settings_post(&$a) { return; -// if(count($a->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'); @@ -182,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; } @@ -194,6 +190,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'feature',substr($k,8),((intval($v)) ? 1 : 0)); } } + build_sync_packet(); return; } @@ -237,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 } @@ -292,7 +290,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) { @@ -550,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) { @@ -719,7 +718,6 @@ function settings_content(&$a) { if((argc() > 1) && (argv(1) === 'features')) { - $arr = array(); $features = get_features(); @@ -739,6 +737,7 @@ function settings_content(&$a) { '$submit' => t('Submit'), '$field_yesno' => 'field_yesno.tpl', )); + return $o; } diff --git a/mod/tagger.php b/mod/tagger.php index 28e10d131..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,7 +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,$tagid); $ret = post_activity_item($arr); if($ret['success']) 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 @@ +<?php /** @file */ + + + +function thing_init(&$a) { + + if(! local_user()) + return; + + $account_id = $a->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) { + + + + +} diff --git a/mod/zfinger.php b/mod/zfinger.php index 48582b3d6..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']; @@ -181,7 +184,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 |