aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-10-23 17:14:50 -0700
committerfriendica <info@friendica.com>2012-10-23 17:14:50 -0700
commit8e8482355baa55a5c9e3cb3553eecf5a733e2897 (patch)
tree69aebb07dd105280cb40997f172b90e58c555510
parent756dcd115e5785dc009bce1e75ebb54c8009dfa7 (diff)
downloadvolse-hubzilla-8e8482355baa55a5c9e3cb3553eecf5a733e2897.tar.gz
volse-hubzilla-8e8482355baa55a5c9e3cb3553eecf5a733e2897.tar.bz2
volse-hubzilla-8e8482355baa55a5c9e3cb3553eecf5a733e2897.zip
more heavy lifting
-rw-r--r--database.sql8
-rw-r--r--doc/Account-Basics.md5
-rw-r--r--done13
-rw-r--r--include/expire.php43
-rw-r--r--mod/attach.php12
-rw-r--r--mod/directory.php19
-rw-r--r--mod/item.php2
-rw-r--r--mod/newmember.php51
-rw-r--r--mod/notify.php52
-rw-r--r--mod/parse_url.php4
-rw-r--r--mod/poco.php23
-rw-r--r--mod/profile.php12
-rw-r--r--mod/wall_attach.php81
13 files changed, 131 insertions, 194 deletions
diff --git a/database.sql b/database.sql
index b6fac9026..0250a3461 100644
--- a/database.sql
+++ b/database.sql
@@ -93,7 +93,7 @@ CREATE TABLE IF NOT EXISTS `attach` (
KEY `aid` (`aid`),
KEY `uid` (`uid`),
KEY `hash` (`hash`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `auth_codes` (
`id` varchar(40) NOT NULL,
@@ -140,6 +140,7 @@ CREATE TABLE IF NOT EXISTS `channel` (
`channel_pageflags` int(10) unsigned NOT NULL DEFAULT '0',
`channel_max_anon_mail` int(10) unsigned NOT NULL DEFAULT '10',
`channel_max_friend_req` int(10) unsigned NOT NULL DEFAULT '10',
+ `channel_expire_days` int(11) NOT NULL DEFAULT '0',
`channel_passwd_reset` char(255) NOT NULL DEFAULT '',
`channel_default_gid` int(10) unsigned NOT NULL DEFAULT '0',
`channel_allow_cid` mediumtext NOT NULL,
@@ -183,7 +184,8 @@ CREATE TABLE IF NOT EXISTS `channel` (
KEY `channel_w_chat` (`channel_w_chat`),
KEY `channel_guid` (`channel_guid`),
KEY `channel_guid_sig` (`channel_guid_sig`),
- KEY `channel_hash` (`channel_hash`)
+ KEY `channel_hash` (`channel_hash`),
+ KEY `channel_expire_days` (`channel_expire_days`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `clients` (
@@ -571,7 +573,7 @@ CREATE TABLE IF NOT EXISTS `item` (
FULLTEXT KEY `allow_gid` (`allow_gid`),
FULLTEXT KEY `deny_cid` (`deny_cid`),
FULLTEXT KEY `deny_gid` (`deny_gid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `item_id` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
diff --git a/doc/Account-Basics.md b/doc/Account-Basics.md
index 41ca95b36..522b0db38 100644
--- a/doc/Account-Basics.md
+++ b/doc/Account-Basics.md
@@ -57,11 +57,6 @@ Otherwise, enter your password. This will have been initially provided in your r
After your first login, please visit the 'Settings' page from the top menu bar and change your password to something that you will remember.
-**Getting Started**
-
-A ['Tips for New Members'](newmember) link will show up on your home page for two weeks to provide some important Getting Started information.
-
-
**Retrieving Personal Data**
You can export a copy of your personal data in XML format from the "Export personal data" link at the top of your settings page.
diff --git a/done b/done
index 92755225b..1fd62bfa8 100644
--- a/done
+++ b/done
@@ -35,7 +35,7 @@ include/
- email.php
enotify.php
event.php
- expire.php
++ expire.php
fcontact.php
follow.php
gprobe.php
@@ -85,7 +85,7 @@ mod/
allfriends.php
api.php
+ apps.php
- attach.php
++ attach.php
? auth.php
cb.php
common.php
@@ -130,20 +130,19 @@ mod/
mood.php
msearch.php
? network.php
- newmember.php
nogroup.php
notifications.php
- notify.php
++ notify.php
? oembed.php
+ oexchange.php
+ opensearch.php
- parse_url.php
+= parse_url.php
? photo.php
photos.php
+ ping.php (needs more work)
poco.php
poke.php
- post.php
+? post.php
+ pretheme.php
probe.php
? profile_photo.php
@@ -176,7 +175,7 @@ mod/
viewsrc.php
wall_attach.php
wallmessage.php
- wall_upload.php
+? wall_upload.php (needs remote permissions refactor)
webfinger.php
+ _well_known.php
xrd.php
diff --git a/include/expire.php b/include/expire.php
index 755cd2494..3a914a41d 100644
--- a/include/expire.php
+++ b/include/expire.php
@@ -1,50 +1,31 @@
<?php
-require_once("boot.php");
+require_once('boot.php');
+require_once('include/cli_startup.php');
function expire_run($argv, $argc){
- global $a, $db;
-
- if(is_null($a)) {
- $a = new App;
- }
-
- if(is_null($db)) {
- @include(".htconfig.php");
- require_once("dba.php");
- $db = new dba($db_host, $db_user, $db_pass, $db_data);
- unset($db_host, $db_user, $db_pass, $db_data);
- };
-
- require_once('include/session.php');
- require_once('include/datetime.php');
- require_once('library/simplepie/simplepie.inc');
- require_once('include/items.php');
- require_once('include/Contact.php');
-
- load_config('config');
- load_config('system');
-
-
- $a->set_baseurl(get_config('system','url'));
+ cli_startup();
// physically remove anything that has been deleted for more than two months
- $r = q("delete from item where deleted = 1 and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY");
+ $r = q("delete from item where item_flags & %d and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY",
+ intval(ITEM_DELETED)
+ );
// make this optional as it could have a performance impact on large sites
if(intval(get_config('system','optimize_items')))
q("optimize table item");
- logger('expire: start');
+ logger('expire: start', LOGGER_DEBUG);
- $r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
- if(count($r)) {
+
+ $r = q("SELECT channel_id, channel_address, channel_expire_days from channel where channel_expire_days != 0");
+ if($r && count($r)) {
foreach($r as $rr) {
- logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG);
- item_expire($rr['uid'],$rr['expire']);
+ logger('Expire: ' . $rr['channel_address'] . ' interval: ' . $rr['channel_expire_days'], LOGGER_DEBUG);
+ item_expire($rr['channel_id'],$rr['channel_expire_days']);
}
}
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)