diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Contact.php | 53 | ||||
-rw-r--r-- | include/Scrape.php | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | include/config.php | 0 | ||||
-rw-r--r-- | include/contact_widgets.php | 2 | ||||
-rw-r--r-- | include/conversation.php | 10 | ||||
-rw-r--r-- | include/group.php | 1 | ||||
-rw-r--r-- | include/items.php | 24 | ||||
-rw-r--r-- | include/network.php | 34 | ||||
-rw-r--r-- | include/profile_selectors.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | include/security.php | 4 | ||||
-rw-r--r-- | include/text.php | 28 |
11 files changed, 124 insertions, 38 deletions
diff --git a/include/Contact.php b/include/Contact.php index d9949b1ef..388819b01 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -23,16 +23,24 @@ function user_remove($uid) { ); q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `gcign` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `group` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `group_member` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `intro` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `event` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `item` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `item_id` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `mail` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `mailacct` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `manage` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `notify` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `photo` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `attach` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `profile` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `profile_check` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `pconfig` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `search` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `spam` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `user` WHERE `uid` = %d", intval($uid)); if($uid == local_user()) { unset($_SESSION['authenticated']); @@ -134,11 +142,11 @@ function contact_photo_menu($contact) { $posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['id']; $menu = Array( - t("View status") => $status_link, - t("View profile") => $profile_link, - t("View photos") => $photos_link, - t("View recent") => $posts_link, - t("Edit contact") => $contact_url, + t("View Status") => $status_link, + t("View Profile") => $profile_link, + t("View Photos") => $photos_link, + t("Network Posts") => $posts_link, + t("Edit Contact") => $contact_url, t("Send PM") => $pm_url, ); @@ -150,7 +158,7 @@ function contact_photo_menu($contact) { $o = ""; foreach($menu as $k=>$v){ if ($v!="") { - if(($k !== t("View recent")) && ($k !== t("Send PM"))) + if(($k !== t("Network Posts")) && ($k !== t("Send PM"))) $o .= "<li><a target=\"redir\" href=\"$v\">$k</a></li>\n"; else $o .= "<li><a href=\"$v\">$k</a></li>\n"; @@ -158,3 +166,36 @@ function contact_photo_menu($contact) { } return $o; }} + + +function random_profile() { + $r = q("select url from gcontact where url like '%%://%%/profile/%%' order by rand() limit 1"); + if(count($r)) + return dirname($r[0]['url']); + return ''; +} + + +function contacts_not_grouped($uid,$start = 0,$count = 0) { + + if(! $count) { + $r = q("select count(*) as total from contact where uid = %d and self = 0 and id not in (select distinct(`contact-id`) from group_member where uid = %d) ", + intval($uid), + intval($uid) + ); + + return $r; + + + } + + $r = q("select * from contact where uid = %d and self = 0 and id not in (select distinct(`contact-id`) from group_member where uid = %d) and blocked = 0 and pending = 0 limit %d, %d", + intval($uid), + intval($uid), + intval($start), + intval($count) + ); + + return $r; +} + diff --git a/include/Scrape.php b/include/Scrape.php index 9c237916b..141c90dcf 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -446,7 +446,7 @@ function probe_url($url, $mode = PROBE_NORMAL) { $phost = substr($url,strpos($url,'@')+1); $profile = 'http://' . $phost; // fix nick character range - $vcard = array('fn' => $name, 'nick' => $name, 'photo' => gravatar_img($url)); + $vcard = array('fn' => $name, 'nick' => $name, 'photo' => avatar_img($url)); $notify = 'smtp ' . random_string(); $poll = 'email ' . random_string(); $priority = 0; @@ -655,7 +655,7 @@ function probe_url($url, $mode = PROBE_NORMAL) { } if((! $vcard['photo']) && strlen($email)) - $vcard['photo'] = gravatar_img($email); + $vcard['photo'] = avatar_img($email); if($poll === $profile) $lnk = $feed->get_permalink(); if(isset($lnk) && strlen($lnk)) diff --git a/include/config.php b/include/config.php index 4cff38090..4cff38090 100755..100644 --- a/include/config.php +++ b/include/config.php diff --git a/include/contact_widgets.php b/include/contact_widgets.php index e0f37f078..96b02f293 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -12,6 +12,7 @@ function follow_widget() { } function findpeople_widget() { + require_once('include/Contact.php'); $a = get_app(); @@ -32,6 +33,7 @@ function findpeople_widget() { '$findthem' => t('Find'), '$suggest' => t('Friend Suggestions'), '$similar' => t('Similar Interests'), + '$random' => t('Random Profile'), '$inv' => t('Invite Friends') )); diff --git a/include/conversation.php b/include/conversation.php index df92a40ed..5396a125d 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -810,11 +810,11 @@ function item_photo_menu($item){ } $menu = Array( - t("View status") => $status_link, - t("View profile") => $profile_link, - t("View photos") => $photos_link, - t("View recent") => $posts_link, - t("Edit contact") => $contact_url, + t("View Status") => $status_link, + t("View Profile") => $profile_link, + t("View Photos") => $photos_link, + t("Network Posts") => $posts_link, + t("Edit Contact") => $contact_url, t("Send PM") => $pm_url, ); diff --git a/include/group.php b/include/group.php index 4a35912e5..edb547de6 100644 --- a/include/group.php +++ b/include/group.php @@ -212,6 +212,7 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0 '$title' => t('Groups'), '$edittext' => t('Edit group'), '$createtext' => t('Create a new group'), + '$ungrouped' => (($every === 'contacts') ? t('Contacts not in any group') : ''), '$groups' => $groups, '$add' => t('add'), )); diff --git a/include/items.php b/include/items.php index ee6960534..85df340d3 100644 --- a/include/items.php +++ b/include/items.php @@ -19,9 +19,15 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) $converse = true; if($a->argv[$x] == 'starred') $starred = true; + if($a->argv[$x] === 'category' && $a->argc > ($x + 1) && strlen($a->argv[$x+1])) + $category = $a->argv[$x+1]; } + + } + + // default permissions - anonymous user $sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' "; @@ -101,6 +107,10 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) if(! strlen($last_update)) $last_update = 'now -30 days'; + if(x($category)) { + $sql_extra .= file_tag_file_query('item',$category,'category'); + } + if($public_feed) { if(! $converse) $sql_extra .= " AND `contact`.`self` = 1 "; @@ -1856,6 +1866,8 @@ function local_delivery($importer,$data) { $feed->enable_order_by_date(false); $feed->init(); +/* + // Currently unsupported - needs a lot of work $reloc = $feed->get_feed_tags( NAMESPACE_DFRN, 'relocate' ); if(isset($reloc[0]['child'][NAMESPACE_DFRN])) { $base = $reloc[0]['child'][NAMESPACE_DFRN]; @@ -1880,6 +1892,7 @@ function local_delivery($importer,$data) { // schedule a scan? } +*/ // handle friend suggestion notification @@ -2971,12 +2984,23 @@ function item_expire($uid,$days) { if($expire_items==0 && $item['type']!='note') continue; + $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), dbesc(datetime_convert()), intval($item['id']) ); + $r = q("DELETE FROM item_id where iid in (select id from item where parent = %d) and uid = %d", + intval($item['id']), + intval($uid) + ); + + $r = q("DELETE FROM sign where iid in (select id from item where parent = %d) and uid = %d", + intval($item['id']), + intval($uid) + ); + // kill the kids $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d ", diff --git a/include/network.php b/include/network.php index 38d0980d5..8c678a443 100644 --- a/include/network.php +++ b/include/network.php @@ -587,13 +587,14 @@ function fetch_xrd_links($url) { if(! function_exists('validate_url')) { function validate_url(&$url) { - // no naked subdomains - if(strpos($url,'.') === false) + + // no naked subdomains (allow localhost for tests) + if(strpos($url,'.') === false && strpos($url,'/localhost/') === false) return false; if(substr($url,0,4) != 'http') $url = 'http://' . $url; $h = @parse_url($url); - + if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR))) { return true; } @@ -692,18 +693,23 @@ function allowed_email($email) { }} -if(! function_exists('gravatar_img')) { -function gravatar_img($email) { - $size = 175; - $opt = 'identicon'; // psuedo-random geometric pattern if not found - $rating = 'pg'; - $hash = md5(trim(strtolower($email))); - - $url = 'http://www.gravatar.com/avatar/' . $hash . '.jpg' - . '?s=' . $size . '&d=' . $opt . '&r=' . $rating; +if(! function_exists('avatar_img')) { +function avatar_img($email) { + + $a = get_app(); + + $avatar['size'] = 175; + $avatar['email'] = $email; + $avatar['url'] = ''; + $avatar['success'] = false; + + call_hooks('avatar_lookup', $avatar); + + if(! $avatar['success']) + $avatar['url'] = $a->get_baseurl() . '/images/person-175.jpg'; - logger('gravatar: ' . $email . ' ' . $url); - return $url; + logger('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], LOGGER_DEBUG); + return $avatar['url']; }} diff --git a/include/profile_selectors.php b/include/profile_selectors.php index 92579f64a..a2cef959d 100644 --- a/include/profile_selectors.php +++ b/include/profile_selectors.php @@ -30,7 +30,7 @@ function sexpref_selector($current="",$suffix="") { function marital_selector($current="",$suffix="") { $o = ''; - $select = array('', t('Single'), t('Lonely'), t('Available'), t('Unavailable'), t('Dating'), t('Unfaithful'), t('Sex Addict'), t('Friends'), t('Friends/Benefits'), t('Casual'), t('Engaged'), t('Married'), t('Partners'), t('Cohabiting'), t('Happy'), t('Not Looking'), t('Swinger'), t('Betrayed'), t('Separated'), t('Unstable'), t('Divorced'), t('Widowed'), t('Uncertain'), t('Complicated'), t('Don\'t care'), t('Ask me') ); + $select = array('', t('Single'), t('Lonely'), t('Available'), t('Unavailable'), t('Has crush'), t('Infatuated'), t('Dating'), t('Unfaithful'), t('Sex Addict'), t('Friends'), t('Friends/Benefits'), t('Casual'), t('Engaged'), t('Married'), t('Imaginarily married'), t('Partners'), t('Cohabiting'), t('Common law'), t('Happy'), t('Not looking'), t('Swinger'), t('Betrayed'), t('Separated'), t('Unstable'), t('Divorced'), t('Imaginarily divorced'), t('Widowed'), t('Uncertain'), t('It\'s complicated'), t('Don\'t care'), t('Ask me') ); $o .= "<select name=\"marital\" id=\"marital-select\" size=\"1\" >"; foreach($select as $selection) { diff --git a/include/security.php b/include/security.php index 66622fd33..fc816e5d7 100644..100755 --- a/include/security.php +++ b/include/security.php @@ -326,7 +326,7 @@ function check_form_security_token($typename = '', $formname = 'form_security_to } function check_form_security_std_err_msg() { - return t('The form security token was not correct. This probably happened because the form has been opened for too long (>3 hours) before subitting it.') . EOL; + return t('The form security token was not correct. This probably happened because the form has been opened for too long (>3 hours) before submitting it.') . EOL; } function check_form_security_token_redirectOnErr($err_redirect, $typename = '', $formname = 'form_security_token') { if (!check_form_security_token($typename, $formname)) { @@ -344,4 +344,4 @@ function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'f header('HTTP/1.1 403 Forbidden'); killme(); } -}
\ No newline at end of file +} diff --git a/include/text.php b/include/text.php index aced9e0a8..8c8db66a9 100644 --- a/include/text.php +++ b/include/text.php @@ -1068,10 +1068,12 @@ function unamp($s) { if(! function_exists('lang_selector')) { function lang_selector() { global $lang; - $o = '<div id="lang-select-icon" class="icon language" title="' . t('Select an alternate language') . '" onclick="openClose(\'language-selector\');" ></div>'; - $o .= '<div id="language-selector" style="display: none;" >'; - $o .= '<form action="#" method="post" ><select name="system_language" onchange="this.form.submit();" >'; + $langs = glob('view/*/strings.php'); + + $lang_options = array(); + $selected = ""; + if(is_array($langs) && count($langs)) { $langs[] = ''; if(! in_array('view/en/strings.php',$langs)) @@ -1079,17 +1081,22 @@ function lang_selector() { asort($langs); foreach($langs as $l) { if($l == '') { - $default_selected = ((! x($_SESSION,'language')) ? ' selected="selected" ' : ''); - $o .= '<option value="" ' . $default_selected . '>' . t('default') . '</option>'; + $lang_options[""] = t('default'); continue; } $ll = substr($l,5); $ll = substr($ll,0,strrpos($ll,'/')); - $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? ' selected="selected" ' : ''); - $o .= '<option value="' . $ll . '"' . $selected . '>' . $ll . '</option>'; + $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? $ll : $selected); + $lang_options[$ll]=$ll; } } - $o .= '</select></form></div>'; + + $tpl = get_markup_template("lang_selector.tpl"); + $o = replace_macros($tpl, array( + '$title' => t('Select an alternate language'), + '$langs' => array($lang_options, $selected), + + )); return $o; }} @@ -1506,3 +1513,8 @@ function undo_post_tagging($s) { return $s; } +function fix_mce_lf($s) { + $s = str_replace("\r\n","\n",$s); + $s = str_replace("\n\n","\n",$s); + return $s; +} |