diff options
author | friendica <info@friendica.com> | 2012-10-23 17:14:50 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-10-23 17:14:50 -0700 |
commit | 8e8482355baa55a5c9e3cb3553eecf5a733e2897 (patch) | |
tree | 69aebb07dd105280cb40997f172b90e58c555510 /mod | |
parent | 756dcd115e5785dc009bce1e75ebb54c8009dfa7 (diff) | |
download | volse-hubzilla-8e8482355baa55a5c9e3cb3553eecf5a733e2897.tar.gz volse-hubzilla-8e8482355baa55a5c9e3cb3553eecf5a733e2897.tar.bz2 volse-hubzilla-8e8482355baa55a5c9e3cb3553eecf5a733e2897.zip |
more heavy lifting
Diffstat (limited to 'mod')
-rw-r--r-- | mod/attach.php | 12 | ||||
-rw-r--r-- | mod/directory.php | 19 | ||||
-rw-r--r-- | mod/item.php | 2 | ||||
-rw-r--r-- | mod/newmember.php | 51 | ||||
-rw-r--r-- | mod/notify.php | 52 | ||||
-rw-r--r-- | mod/parse_url.php | 4 | ||||
-rw-r--r-- | mod/poco.php | 23 | ||||
-rw-r--r-- | mod/profile.php | 12 | ||||
-rw-r--r-- | mod/wall_attach.php | 81 |
9 files changed, 108 insertions, 148 deletions
diff --git a/mod/attach.php b/mod/attach.php index ae6540201..f300ec6fb 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -4,17 +4,17 @@ require_once('include/security.php'); function attach_init(&$a) { - if($a->argc != 2) { + if(argc() != 2) { notice( t('Item not available.') . EOL); return; } - $item_id = intval($a->argv[1]); + $hash = argv(1); // Check for existence, which will also provide us the owner uid - $r = q("SELECT * FROM `attach` WHERE `id` = %d LIMIT 1", - intval($item_id) + $r = q("SELECT * FROM `attach` WHERE `hash` = '%s' LIMIT 1", + dbesc($hash) ); if(! count($r)) { notice( t('Item was not found.'). EOL); @@ -25,8 +25,8 @@ function attach_init(&$a) { // Now we'll see if we can access the attachment - $r = q("SELECT * FROM `attach` WHERE `id` = '%d' $sql_extra LIMIT 1", - dbesc($item_id) + $r = q("SELECT * FROM `attach` WHERE hash = '%s' $sql_extra LIMIT 1", + dbesc($hash) ); if(! count($r)) { diff --git a/mod/directory.php b/mod/directory.php index 6054ad8fd..5744971db 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -9,22 +9,17 @@ function directory_init(&$a) { $a->page['aside'] .= findpeople_widget(); } - else { - unset($_SESSION['theme']); - unset($_SESSION['mobile-theme']); - } - - } +function directory_aside(&$a) { -function directory_post(&$a) { - if(x($_POST,'search')) - $a->data['search'] = $_POST['search']; + if(local_user()) { + require_once('include/contact_widgets.php'); + $a->set_widget('find_people',findpeople_widget()); + } } - function directory_content(&$a) { if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { @@ -35,8 +30,8 @@ function directory_content(&$a) { $o = ''; nav_set_selected('directory'); - if(x($a->data,'search')) - $search = notags(trim($a->data['search'])); + if(x($_POST,'search')) + $search = notags(trim($_POST['search'])); else $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); diff --git a/mod/item.php b/mod/item.php index c0907b556..181984d33 100644 --- a/mod/item.php +++ b/mod/item.php @@ -528,7 +528,7 @@ function item_post(&$a) { $attachments = ''; $match = false; - if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) { + if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) { foreach($match[2] as $mtch) { $r = q("SELECT `hash`,`filename`,`filesize`,`filetype` FROM `attach` WHERE `uid` = %d AND `hash` = '%s' LIMIT 1", intval($profile_uid), diff --git a/mod/newmember.php b/mod/newmember.php deleted file mode 100644 index a423d11b8..000000000 --- a/mod/newmember.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -function newmember_content(&$a) { - - - $o = '<h3>' . t('Welcome to Friendica') . '</h3>'; - - $o .= '<h3>' . t('New Member Checklist') . '</h3>'; - - $o .= '<div style="font-size: 120%;">'; - - $o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.'); - - $o .= '<ul>'; - - $o .= '<li>' . '<a target="newmember" href="help/guide">' . t('On your <em>Quick Start</em> page - find a brief introduction to your profile and network tabs, connect to Facebook, make some new connections, and find some groups to join.') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="settings">' . t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="settings">' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="profile_photo">' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</a></li>' . EOL; - - if(in_array('facebook', $a->plugins)) - $o .= '<li>' . '<a target="newmember" href="facebook">' . t("Authorise the Facebook Connector if you currently have a Facebook account and we will \x28optionally\x29 import all your Facebook friends and conversations.") . '</a></li>' . EOL; - else - $o .= '<li>' . '<a target="newmember" href="help/Installing-Connectors">' . t("<em>If</em> this is your own personal server, installing the Facebook addon may ease your transition to the free social web.") . '</a></li>' . EOL; - - $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); - - if(! $mail_disabled) - $o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="directory">' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="contacts">' . t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</a></li>' . EOL; - - $o .= '<li>' . '<a target="newmember" href="help">' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</a></li>' . EOL; - - $o .= '</div>'; - - return $o; -} diff --git a/mod/notify.php b/mod/notify.php index ae8273a1d..dd26bfe7e 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -5,9 +5,9 @@ function notify_init(&$a) { if(! local_user()) return; - if($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) { + if(argc() > 2 && argv(1) === 'view' && intval(argv(2))) { $r = q("select * from notify where id = %d and uid = %d limit 1", - intval($a->argv[2]), + intval(argv(2)), intval(local_user()) ); if(count($r)) { @@ -23,7 +23,7 @@ function notify_init(&$a) { goaway($a->get_baseurl(true)); } - if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) { + if(argc() > 2 && argv(1) === 'mark' && argv(2) === 'all' ) { $r = q("update notify set seen = 1 where uid = %d", intval(local_user()) ); @@ -39,35 +39,35 @@ function notify_content(&$a) { if(! local_user()) return login(); - $notif_tpl = get_markup_template('notifications.tpl'); + $notif_tpl = get_markup_template('notifications.tpl'); - $not_tpl = get_markup_template('notify.tpl'); - require_once('include/bbcode.php'); + $not_tpl = get_markup_template('notify.tpl'); + require_once('include/bbcode.php'); - $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", - intval(local_user()) - ); + $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", + intval(local_user()) + ); - if (count($r) > 0) { - foreach ($r as $it) { - $notif_content .= replace_macros($not_tpl,array( - '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], - '$item_image' => $it['photo'], - '$item_text' => strip_tags(bbcode($it['msg'])), - '$item_when' => relative_date($it['date']) - )); - } - } else { - $notif_content .= t('No more system notifications.'); + if (count($r) > 0) { + foreach ($r as $it) { + $notif_content .= replace_macros($not_tpl,array( + '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], + '$item_image' => $it['photo'], + '$item_text' => strip_tags(bbcode($it['msg'])), + '$item_when' => relative_date($it['date']) + )); } + } + else { + $notif_content .= t('No more system notifications.'); + } - $o .= replace_macros($notif_tpl,array( - '$notif_header' => t('System Notifications'), - '$tabs' => '', // $tabs, - '$notif_content' => $notif_content, - )); + $o .= replace_macros($notif_tpl,array( + '$notif_header' => t('System Notifications'), + '$tabs' => '', // $tabs, + '$notif_content' => $notif_content, + )); return $o; - }
\ No newline at end of file diff --git a/mod/parse_url.php b/mod/parse_url.php index 14b920b23..962c3e368 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -1,4 +1,6 @@ <?php + + /* To-Do https://developers.google.com/+/plugins/snippet/ @@ -342,7 +344,7 @@ function parse_url_content(&$a) { $result = sprintf($template,$url,($title) ? $title : $url,$text) . $str_tags; - logger('parse_url: returns: ' . $result); + logger('parse_url: returns: ' . $result, LOGGER_DEBUG); echo trim($result); killme(); diff --git a/mod/poco.php b/mod/poco.php index 2a5d47909..f93c8ade5 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -8,8 +8,8 @@ function poco_init(&$a) { http_status_exit(401); - if($a->argc > 1) { - $user = notags(trim($a->argv[1])); + if(argc() > 1) { + $user = notags(trim(argv(1))); } if(! x($user)) { $c = q("select * from pconfig where cat = 'system' and k = 'suggestme' and v = 1"); @@ -18,21 +18,24 @@ function poco_init(&$a) { $system_mode = true; } - $format = (($_GET['format']) ? $_GET['format'] : 'json'); + $format = (($_REQUEST['format']) ? $_REQUEST['format'] : 'json'); $justme = false; - if($a->argc > 2 && $a->argv[2] === '@me') + if(argc() > 2 && argv(2) === '@me') $justme = true; - if($a->argc > 3 && $a->argv[3] === '@all') - $justme = false; - if($a->argc > 3 && $a->argv[3] === '@self') - $justme = true; - if($a->argc > 4 && intval($a->argv[4]) && $justme == false) - $cid = intval($a->argv[4]); + if(argc() > 3) { + if(argv(3) === '@all') + $justme = false; + elseif(argv(3) === '@self') + $justme = true; + } + if(argc() > 4 && intval(argv(4)) && $justme == false) + $cid = intval(argv(4)); if(! $system_mode) { + $r = q("SELECT `user`.*,`profile`.`hide_friends` from user left join profile on `user`.`uid` = `profile`.`uid` where `user`.`nickname` = '%s' and `profile`.`is_default` = 1 limit 1", dbesc($user) diff --git a/mod/profile.php b/mod/profile.php index b83dbdf3f..6680636a7 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -12,9 +12,6 @@ function profile_aside(&$a) { require_once('include/contact_widgets.php'); require_once('include/items.php'); - if(! x($a->page,'aside')) - $a->page['aside'] = ''; - if(argc() > 1) $which = argv(1); else { @@ -60,6 +57,8 @@ function profile_content(&$a, $update = 0) { return login(); } + $channel = $a->get_channel(); + require_once("include/bbcode.php"); require_once('include/security.php'); require_once('include/conversation.php'); @@ -147,16 +146,15 @@ function profile_content(&$a, $update = 0) { $celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false); - if(can_write_wall($a,$a->profile['profile_uid'])) { $x = array( 'is_owner' => $is_owner, 'allow_location' => ((($is_owner || $commvisitor) && $a->profile['allow_location']) ? true : false), 'default_location' => (($is_owner) ? $a->user['default-location'] : ''), - 'nickname' => $a->profile['nickname'], - 'lockstate' => (((is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''), + 'nickname' => $channel['channel_address'], + 'lockstate' => (((strlen($channel['channel_allow_cid'])) || (strlen($channel['channel_allow_gid'])) || (strlen($channel['channel_deny_cid'])) || (strlen($channel['channel_deny_gid']))) ? 'lock' : 'unlock'), + 'acl' => (($is_owner) ? populate_acl($channel, $celeb) : ''), 'bang' => '', 'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'), 'profile_uid' => $a->profile['profile_uid'] diff --git a/mod/wall_attach.php b/mod/wall_attach.php index b32e2b877..1b539031b 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -5,52 +5,65 @@ require_once('include/datetime.php'); function wall_attach_post(&$a) { - if($a->argc > 1) { - $nick = $a->argv[1]; - $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1", + + // Figure out who owns the page and if they allow attachments + + if(argc() > 1) { + $nick = argv(1); + $r = q("SELECT channel.* from channel where channel_address = '%s' limit 1", dbesc($nick) ); - if(! count($r)) + if(! ($r && count($r))) return; + $channel = $r[0]; } else return; + $can_post = false; + + $visitor = 0; - $page_owner_uid = $r[0]['uid']; - $page_owner_cid = $r[0]['id']; - $page_owner_nick = $r[0]['nickname']; - $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false); + $page_owner_uid = $channel['channel_id']; + + +// $page_owner_cid = $r[0]['id']; +// $page_owner_nick = $r[0]['nickname']; +// $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false); if((local_user()) && (local_user() == $page_owner_uid)) $can_post = true; - else { - if($community_page && remote_user()) { - $cid = 0; - if(is_array($_SESSION['remote'])) { - foreach($_SESSION['remote'] as $v) { - if($v['uid'] == $page_owner_uid) { - $cid = $v['cid']; - break; - } - } - } - if($cid) { - - $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1", - intval($cid), - intval($page_owner_uid) - ); - if(count($r)) { - $can_post = true; - $visitor = $cid; - } - } - } - } + +// FIXME for forum and guests +// else { +// if($community_page && remote_user()) { +// $cid = 0; +// if(is_array($_SESSION['remote'])) { +// foreach($_SESSION['remote'] as $v) { +// if($v['uid'] == $page_owner_uid) { +// $cid = $v['cid']; +// break; +// } +// } +// } +// if($cid) {// + +// $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1", +// intval($cid), +// intval($page_owner_uid) +// ); +// if(count($r)) { +// $can_post = true; +// $visitor = $cid; +// } +// } +// } +// } + + if(! $can_post) { notice( t('Permission denied.') . EOL ); killme(); @@ -98,7 +111,7 @@ function wall_attach_post(&$a) { dbesc($filedata), dbesc($created), dbesc($created), - dbesc('<' . $page_owner_cid . '>'), + dbesc('<' . $channel['channel_hash'] . '>'), dbesc(''), dbesc(''), dbesc('') @@ -111,7 +124,7 @@ function wall_attach_post(&$a) { killme(); } - $r = q("SELECT `id` FROM `attach` WHERE `uid` = %d AND `created` = '%s' AND `hash` = '%s' LIMIT 1", + $r = q("SELECT `hash` FROM `attach` WHERE `uid` = %d AND `created` = '%s' AND `hash` = '%s' LIMIT 1", intval($page_owner_uid), dbesc($created), dbesc($hash) |