diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/acl.php | 12 | ||||
-rw-r--r-- | mod/chanman.php | 31 | ||||
-rw-r--r-- | mod/channel.php | 2 | ||||
-rw-r--r-- | mod/cloud.php | 8 | ||||
-rw-r--r-- | mod/connedit.php | 6 | ||||
-rwxr-xr-x | mod/events.php | 53 | ||||
-rw-r--r-- | mod/feed.php | 3 | ||||
-rw-r--r-- | mod/filestorage.php | 47 | ||||
-rw-r--r-- | mod/help.php | 26 | ||||
-rw-r--r-- | mod/import.php | 2 | ||||
-rw-r--r-- | mod/item.php | 49 | ||||
-rwxr-xr-x | mod/like.php | 17 | ||||
-rw-r--r-- | mod/locs.php | 90 | ||||
-rw-r--r-- | mod/page.php | 22 | ||||
-rw-r--r-- | mod/photos.php | 216 | ||||
-rw-r--r-- | mod/post.php | 28 | ||||
-rw-r--r-- | mod/profiles.php | 32 | ||||
-rw-r--r-- | mod/settings.php | 229 | ||||
-rw-r--r-- | mod/siteinfo.php | 5 | ||||
-rw-r--r-- | mod/tagrm.php | 120 | ||||
-rw-r--r-- | mod/webpages.php | 4 | ||||
-rw-r--r-- | mod/zotfeed.php | 2 |
22 files changed, 597 insertions, 407 deletions
diff --git a/mod/acl.php b/mod/acl.php index 5658a05c5..01f5103f1 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -11,7 +11,7 @@ function acl_init(&$a){ $count = (x($_REQUEST,'count')?$_REQUEST['count']:100); $search = (x($_REQUEST,'search')?$_REQUEST['search']:""); $type = (x($_REQUEST,'type')?$_REQUEST['type']:""); - + $noforums = (x($_REQUEST,'n') ? $_REQUEST['n'] : false); // For use with jquery.autocomplete for private mail completion @@ -87,7 +87,7 @@ function acl_init(&$a){ $contact_count = (int)$r[0]['c']; } - elseif ($type == 'a') { + elseif (($type == 'a')||($type == 'p')) { // autocomplete for Contacts @@ -168,7 +168,7 @@ function acl_init(&$a){ intval(XCHAN_FLAGS_DELETED) ); } - elseif($type == 'a') { + elseif(($type == 'a') || ($type == 'p')) { $r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and not (xchan_flags & %d) @@ -204,7 +204,7 @@ function acl_init(&$a){ $r = array(); - if($type == 'm' || $type == 'a') { + if($type == 'm' || $type == 'a' || $type == 'p') { $x = array(); $x['query'] = $search; $x['photos'] = array(); @@ -216,7 +216,7 @@ function acl_init(&$a){ $x['photos'][] = $g['micro']; $x['links'][] = $g['url']; $x['suggestions'][] = $g['name']; - $x['data'][] = $g['id']; + $x['data'][] = (($type === 'p') ? '@' . str_replace(' ','_',$g['name']) : $g['id']); } } echo json_encode($x); @@ -230,7 +230,7 @@ function acl_init(&$a){ if(strpos($g['hash'],'/')) continue; - if(($g['abook_their_perms'] & PERMS_W_TAGWALL) && $type == 'c') { + if(($g['abook_their_perms'] & PERMS_W_TAGWALL) && $type == 'c' && (! $noforums)) { $contacts[] = array( "type" => "c", "photo" => "images/twopeople.png", diff --git a/mod/chanman.php b/mod/chanman.php deleted file mode 100644 index 7a89708d7..000000000 --- a/mod/chanman.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php /** @file */ - - -/** - Placeholder file at present. This is going to involve a bit of work. - - This file will deal with the deletion of channels and management of hublocs. - - We need to provide the following functionality: - - - Delete my account and all channels from the entire network - - - Delete my account and all channels from this server - - - Delete a channel from the entire network - - - Delete a channel from this server - - - List all hub locations for this channel - - - Remove this/some hub location from this channel - - - promote this/some hub location to primary - - - Remove hub location 'xyz' from this channel, (this should possibly only be allowed if that hub has been down for a period of time) - - - Some of these actions should probably require email verification - -*/ - - diff --git a/mod/channel.php b/mod/channel.php index 395160d2c..e4a7173c0 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -64,7 +64,7 @@ function channel_content(&$a, $update = 0, $load = false) { if($update) { // Ensure we've got a profile owner if updating. - $a->profile['profile_uid'] = $update; + $a->profile['profile_uid'] = $a->profile_uid = $update; } else { if($a->profile['profile_uid'] == local_user()) { diff --git a/mod/cloud.php b/mod/cloud.php index 149a6da5d..27724f6b0 100644 --- a/mod/cloud.php +++ b/mod/cloud.php @@ -63,7 +63,7 @@ function cloud_init(&$a) { if ($which) profile_load($a, $which, $profile); - $auth = new RedBasicAuth(); + $auth = new RedDAV\RedBasicAuth(); $ob_hash = get_observer_hash(); @@ -91,7 +91,7 @@ function cloud_init(&$a) { $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['REQUEST_URI']); - $rootDirectory = new RedDirectory('/', $auth); + $rootDirectory = new RedDAV\RedDirectory('/', $auth); // A SabreDAV server-object $server = new DAV\Server($rootDirectory); @@ -117,7 +117,7 @@ function cloud_init(&$a) { if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) { try { $x = RedFileData('/' . $a->cmd, $auth); - if($x instanceof RedFile) + if($x instanceof RedDAV\RedFile) $isapublic_file = true; } catch (Exception $e) { @@ -150,4 +150,4 @@ function cloud_init(&$a) { $server->exec(); killme(); -}
\ No newline at end of file +} diff --git a/mod/connedit.php b/mod/connedit.php index 7ad719738..b10d9f3b8 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -261,6 +261,12 @@ function connedit_content(&$a) { $x = get_role_perms($role); if($x['perms_accept']) $my_perms = $x['perms_accept']; + else { + // fixme - we need to be able to define these somewhere for the custom role + $my_perms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK + |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT + |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; + } } if($my_perms) { $o .= "<script>function connectDefaultShare() { diff --git a/mod/events.php b/mod/events.php index c80d1dd39..513899308 100755 --- a/mod/events.php +++ b/mod/events.php @@ -12,24 +12,14 @@ function events_post(&$a) { return; $event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0); + $event_hash = ((x($_POST,'event_hash')) ? $_POST['event_hash'] : ''); + $xchan = ((x($_POST,'xchan')) ? dbesc($_POST['xchan']) : ''); $uid = local_user(); $start_text = escape_tags($_REQUEST['start_text']); $finish_text = escape_tags($_REQUEST['finish_text']); - $startyear = intval($_POST['startyear']); - $startmonth = intval($_POST['startmonth']); - $startday = intval($_POST['startday']); - $starthour = intval($_POST['starthour']); - $startminute = intval($_POST['startminute']); - - $finishyear = intval($_POST['finishyear']); - $finishmonth = intval($_POST['finishmonth']); - $finishday = intval($_POST['finishday']); - $finishhour = intval($_POST['finishhour']); - $finishminute = intval($_POST['finishminute']); - $adjust = intval($_POST['adjust']); $nofinish = intval($_POST['nofinish']); @@ -79,17 +69,22 @@ function events_post(&$a) { // and we'll waste a bunch of time responding to it. Time that // could've been spent doing something else. - if(strcmp($finish,$start) < 0) - $finish = $start; $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); $location = escape_tags(trim($_POST['location'])); $type = 'event'; + $action = ($event_hash == '') ? 'new' : "event/" . $event_hash; + $onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish"; + if(strcmp($finish,$start) < 0 && !$nofinish) { + notice( t('Event can not end before it has started.') . EOL); + goaway($onerror_url); + } + if((! $summary) || (! $start)) { notice( t('Event title and start time are required.') . EOL); - goaway($a->get_baseurl() . '/events/new'); + goaway($onerror_url); } $share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0); @@ -460,6 +455,19 @@ function events_content(&$a) { $channel = $a->get_channel(); + // Passed parameters overrides anything found in the DB + if($mode === 'edit' || $mode === 'new') { + if(!x($orig_event)) $orig_event = array(); + // In case of an error the browser is redirected back here, with these parameters filled in with the previous values + if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish']; + if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust']; + if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary']; + if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description']; + if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location']; + if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start']; + if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish']; + } + if($mode === 'edit' || $mode === 'new') { $n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : ''); @@ -530,11 +538,6 @@ function events_content(&$a) { } } - - - $dateformat = datesel_format($f); - $timeformat = t('hour:minute'); - require_once('include/acl_selectors.php'); $perm_defaults = array( @@ -552,26 +555,23 @@ function events_content(&$a) { '$eid' => $eid, '$xchan' => $event_xchan, '$mid' => $mid, + '$event_hash' => $event_id, '$title' => t('Event details'), - '$format_desc' => sprintf( t('Format is %s %s.'),$dateformat,$timeformat), '$desc' => t('Starting date and Title are required.'), '$catsenabled' => $catsenabled, '$placeholdercategory' => t('Categories (comma-separated list)'), '$category' => $category, '$s_text' => t('Event Starts:') . ' <span class="required" title="' . t('Required') . '">*</span>', - '$bootstrap' => 1, '$stext' => $stext, '$ftext' => $ftext, '$ModalCANCEL' => t('Cancel'), '$ModalOK' => t('OK'), - '$s_dsel' => datesel($f,'start',$syear+5,$syear,false,$syear,$smonth,$sday), - '$s_tsel' => timesel('start',$shour,$sminute), + '$s_dsel' => datetimesel($f,mktime(),mktime(0,0,0,0,0,$syear+5),mktime($shour,$sminute,$ssecond,$smonth,$sday,$syear),'start_text'), '$n_text' => t('Finish date/time is not known or not relevant'), '$n_checked' => $n_checked, '$f_text' => t('Event Finishes:'), - '$f_dsel' => datesel($f,'finish',$fyear+5,$fyear,false,$fyear,$fmonth,$fday), - '$f_tsel' => timesel('finish',$fhour,$fminute), + '$f_dsel' => datetimesel($f,mktime(),mktime(0,0,0,0,0,$fyear+5),mktime($fhour,$fminute,$fsecond,$fmonth,$fday,$fyear),'finish_text',true,true,'start_text'), '$a_text' => t('Adjust for viewer timezone'), '$a_checked' => $a_checked, '$d_text' => t('Description:'), @@ -582,6 +582,7 @@ function events_content(&$a) { '$t_orig' => $t_orig, '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, + '$permissions' => t('Permissions'), '$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults),false)), '$submit' => t('Submit') diff --git a/mod/feed.php b/mod/feed.php index 776f9787f..3b622fc17 100644 --- a/mod/feed.php +++ b/mod/feed.php @@ -12,6 +12,9 @@ function feed_init(&$a) { $params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml'); $params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0); $params['top'] = ((x($_REQUEST,'top')) ? intval($_REQUEST['top']) : 0); + $params['start'] = ((x($params,'start')) ? intval($params['start']) : 0); + $params['records'] = ((x($params,'records')) ? intval($params['records']) : 40); + $params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc'); $channel = ''; if(argc() > 1) { diff --git a/mod/filestorage.php b/mod/filestorage.php index 383af84fc..e27087a92 100644 --- a/mod/filestorage.php +++ b/mod/filestorage.php @@ -1,18 +1,26 @@ <?php +/** + * @file mod/filestorage.php + * + */ require_once('include/attach.php'); +/** + * + * @param object &$a + */ function filestorage_post(&$a) { - $channel_id = ((x($_POST,'uid')) ? intval($_POST['uid']) : 0); + $channel_id = ((x($_POST, 'uid')) ? intval($_POST['uid']) : 0); if((! $channel_id) || (! local_user()) || ($channel_id != local_user())) { notice( t('Permission denied.') . EOL); return; } - $recurse = ((x($_POST,'recurse')) ? intval($_POST['recurse']) : 0); - $resource = ((x($_POST,'filehash')) ? notags($_POST['filehash']) : ''); + $recurse = ((x($_POST, 'recurse')) ? intval($_POST['recurse']) : 0); + $resource = ((x($_POST, 'filehash')) ? notags($_POST['filehash']) : ''); if(! $resource) { notice(t('Item not found.') . EOL); @@ -24,11 +32,11 @@ function filestorage_post(&$a) { $str_group_deny = perms2str($_REQUEST['group_deny']); $str_contact_deny = perms2str($_REQUEST['contact_deny']); - attach_change_permissions($channel_id,$resource,$str_contact_allow,$str_group_allow,$str_contact_deny,$str_group_deny,$recurse = false); + attach_change_permissions($channel_id, $resource, $str_contact_allow, $str_group_allow, $str_contact_deny,$str_group_deny, $recurse = false); //Build directory tree and redirect $channel = $a->get_channel(); - $cloudPath = get_parent_cloudpath($channel_id, $channel['channel_address'], $resource) ; + $cloudPath = get_parent_cloudpath($channel_id, $channel['channel_address'], $resource); goaway($cloudPath); } @@ -53,15 +61,15 @@ function filestorage_content(&$a) { $observer = $a->get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); - $perms = get_all_perms($owner,$ob_hash); + $perms = get_all_perms($owner, $ob_hash); if(! $perms['view_storage']) { notice( t('Permission denied.') . EOL); return; } - // Since we have ACL'd files in the wild, but don't have ACL here yet, we - // need to return for anyone other than the owner, despite the perms check for now. + // Since we have ACL'd files in the wild, but don't have ACL here yet, we + // need to return for anyone other than the owner, despite the perms check for now. $is_owner = (((local_user()) && ($owner == local_user())) ? true : false); if(! $is_owner) { @@ -69,7 +77,6 @@ function filestorage_content(&$a) { return; } - if(argc() > 3 && argv(3) === 'delete') { if(! $perms['write_storage']) { notice( t('Permission denied.') . EOL); @@ -77,7 +84,7 @@ function filestorage_content(&$a) { } $file = intval(argv(2)); - $r = q("select hash from attach where id = %d and uid = %d limit 1", + $r = q("SELECT hash FROM attach WHERE id = %d AND uid = %d LIMIT 1", dbesc($file), intval($owner) ); @@ -86,11 +93,15 @@ function filestorage_content(&$a) { goaway(z_root() . '/cloud/' . $which); } - attach_delete($owner,$r[0]['hash']); - - goaway(z_root() . '/cloud/' . $which); - } + $f = $r[0]; + $channel = $a->get_channel(); + + $parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']); + attach_delete($owner, $f['hash']); + + goaway($parentpath); + } if(argc() > 3 && argv(3) === 'edit') { require_once('include/acl_selectors.php'); @@ -106,18 +117,16 @@ function filestorage_content(&$a) { ); $f = $r[0]; - $channel = $a->get_channel(); $cloudpath = get_cloudpath($f) . (($f['flags'] & ATTACH_FLAG_DIR) ? '?f=&davguest=1' : ''); $parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']); - $aclselect_e = populate_acl($f,false); + $aclselect_e = populate_acl($f, false); $is_a_dir = (($f['flags'] & ATTACH_FLAG_DIR) ? true : false); $lockstate = (($f['allow_cid'] || $f['allow_gid'] || $f['deny_cid'] || $f['deny_gid']) ? 'lock' : 'unlock'); - $o = replace_macros(get_markup_template('attach_edit.tpl'), array( '$header' => t('Edit file permissions'), '$file' => $f, @@ -135,12 +144,10 @@ function filestorage_content(&$a) { '$cpdesc' => t('Copy/paste this code to attach file to a post'), '$cpldesc' => t('Copy/paste this URL to link file from a web page'), '$submit' => t('Submit') - )); return $o; - } + } goaway(z_root() . '/cloud/' . $which); - } diff --git a/mod/help.php b/mod/help.php index 81ecd6ba9..4823f1c07 100644 --- a/mod/help.php +++ b/mod/help.php @@ -34,8 +34,6 @@ function help_content(&$a) { $doctype = 'markdown'; - require_once('library/markdown.php'); - $text = ''; if(argc() > 1) { @@ -73,17 +71,22 @@ function help_content(&$a) { )); } - $text = preg_replace_callback("/#include (.*?)\;/ism", 'preg_callback_help_include', $text); - if($doctype === 'html') $content = $text; - if($doctype === 'markdown') + if($doctype === 'markdown') { + require_once('library/markdown.php'); + # escape #include tags + $text = preg_replace('/#include/ism', '%%include', $text); $content = Markdown($text); + $content = preg_replace('/%%include/ism', '#include', $content); + } if($doctype === 'bbcode') { require_once('include/bbcode.php'); $content = bbcode($text); } + $content = preg_replace_callback("/#include (.*?)\;/ism", 'preg_callback_help_include', $content); + return replace_macros(get_markup_template("help.tpl"), array( '$content' => $content )); @@ -93,8 +96,17 @@ function help_content(&$a) { function preg_callback_help_include($matches) { - if($matches[1]) - return str_replace($matches[0],load_doc_file($matches[1]),$matches[0]); + if($matches[1]) { + $include = str_replace($matches[0],load_doc_file($matches[1]),$matches[0]); + if(preg_match('/\.bb$/', $matches[1])) { + require_once('include/bbcode.php'); + $include = bbcode($include); + } elseif(preg_match('/\.md$/', $matches[1])) { + require_once('library/markdown.php'); + $include = Markdown($include); + } + return $include; + } } diff --git a/mod/import.php b/mod/import.php index 3cf114d66..44dfcc38d 100644 --- a/mod/import.php +++ b/mod/import.php @@ -344,7 +344,7 @@ function import_post(&$a) { unset($group['id']); $group['uid'] = $channel['channel_id']; dbesc_array($group); - $r = dbq("INSERT INTO group (`" + $r = dbq("INSERT INTO groups (`" . implode("`, `", array_keys($group)) . "`) VALUES ('" . implode("', '", array_values($group)) diff --git a/mod/item.php b/mod/item.php index ac15e50e8..3dea8809c 100644 --- a/mod/item.php +++ b/mod/item.php @@ -77,7 +77,7 @@ function item_post(&$a) { $preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0); $categories = ((x($_REQUEST,'category')) ? escape_tags($_REQUEST['category']) : ''); $webpage = ((x($_REQUEST,'webpage')) ? intval($_REQUEST['webpage']) : 0); - $pagetitle = ((x($_REQUEST,'pagetitle')) ? escape_tags($_REQUEST['pagetitle']) : ''); + $pagetitle = ((x($_REQUEST,'pagetitle')) ? escape_tags(urlencode($_REQUEST['pagetitle'])) : ''); $layout_mid = ((x($_REQUEST,'layout_mid')) ? escape_tags($_REQUEST['layout_mid']): ''); $plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : ''); @@ -257,8 +257,25 @@ function item_post(&$a) { killme(); } + $walltowall = false; + $walltowall_comment = false; + if($observer) { logger('mod_item: post accepted from ' . $observer['xchan_name'] . ' for ' . $owner_xchan['xchan_name'], LOGGER_DEBUG); + + // wall-to-wall detection. + // For top-level posts, if the author and owner are different it's a wall-to-wall + // For comments, We need to additionally look at the parent and see if it's a wall post that originated locally. + + if($observer['xchan_name'] != $owner_xchan['xchan_name']) { + if($parent_item && ($parent_item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) == (ITEM_WALL|ITEM_ORIGIN)) { + $walltowall_comment = true; + $walltowall = true; + } + if(! $parent) { + $walltowall = true; + } + } } $public_policy = ((x($_REQUEST,'public_policy')) ? escape_tags($_REQUEST['public_policy']) : map_scope($channel['channel_r_stream'],true)); @@ -329,6 +346,15 @@ function item_post(&$a) { $str_group_deny = $channel['channel_deny_gid']; $str_contact_deny = $channel['channel_deny_cid']; } + elseif($walltowall) { + + // use the channel owner's default permissions + + $str_group_allow = $channel['channel_allow_gid']; + $str_contact_allow = $channel['channel_allow_cid']; + $str_group_deny = $channel['channel_deny_gid']; + $str_contact_deny = $channel['channel_deny_cid']; + } else { // use the posted permissions @@ -570,7 +596,14 @@ function item_post(&$a) { logger('handle_tag: ' . print_r($success,tue), LOGGER_DATA); if(($access_tag) && (! $parent_item)) { logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DATA); - if ($first_access_tag) { + if ($first_access_tag && (! get_pconfig($profile_uid,'system','no_private_mention_acl_override'))) { + + // This is a tough call, hence configurable. The issue is that one can type in a @!privacy mention + // and also have a default ACL (perhaps from viewing a collection) and could be suprised that the + // privacy mention wasn't the only recipient. So the default is to wipe out the existing ACL if a + // private mention is found. This can be over-ridden if you wish private mentions to be in + // addition to the current ACL settings. + $str_contact_allow = ''; $str_group_allow = ''; $first_access_tag = false; @@ -859,10 +892,9 @@ function item_post(&$a) { if($parent) { // Store the comment signature information in case we need to relay to Diaspora -//FIXME $ditem = $datarray; $ditem['author'] = $observer; - store_diaspora_comment_sig($ditem,$channel,$parent_item, $post_id); + store_diaspora_comment_sig($ditem,$channel,$parent_item, $post_id, (($walltowall_comment) ? 1 : 0)); } update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); @@ -1137,6 +1169,8 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) { // $r is set if we found something + $channel = get_app()->get_channel(); + if($r) { $profile = $r[0]['xchan_url']; $newname = $r[0]['xchan_name']; @@ -1156,9 +1190,10 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) { if(local_user() && local_user() == $profile_uid) { require_once('include/group.php'); $grp = group_byname($profile_uid,$name); + if($grp) { $g = q("select hash from groups where id = %d and visible = 1 limit 1", - intval($grp[0]['id']) + intval($grp) ); if($g && $exclusive) { $access_tag .= 'gid:' . $g[0]['hash']; @@ -1172,6 +1207,10 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) { } } + if(($exclusive) && (! $access_tag)) { + $access_tag .= 'cid:' . $channel['channel_hash']; + } + // if there is an url for this channel if(isset($profile)) { diff --git a/mod/like.php b/mod/like.php index 916faf230..f4fd33787 100755 --- a/mod/like.php +++ b/mod/like.php @@ -209,13 +209,17 @@ function like_content(&$a) { } else { + // this is used to like an item or comment + $item_id = ((argc() == 2) ? notags(trim(argv(1))) : 0); logger('like: verb ' . $verb . ' item ' . $item_id, LOGGER_DEBUG); + // get the item. Allow linked photos (which are normally hidden) to be liked - $r = q("SELECT * FROM item WHERE id = %d and item_restrict = 0 LIMIT 1", - dbesc($item_id) + $r = q("SELECT * FROM item WHERE id = %d and (item_restrict = 0 or item_restrict = %d) LIMIT 1", + intval($item_id), + intval(ITEM_HIDDEN) ); if(! $item_id || (! $r)) { @@ -325,6 +329,15 @@ function like_content(&$a) { if($item['item_flags'] & ITEM_WALL) $item_flags |= ITEM_WALL; + // if this was a linked photo and was hidden, unhide it. + + if($item['item_restrict'] & ITEM_HIDDEN) { + $r = q("update item set item_restrict = (item_restrict ^ %d) where id = %d limit 1", + intval(ITEM_HIDDEN), + intval($item['id']) + ); + } + } if($verb === 'like') diff --git a/mod/locs.php b/mod/locs.php new file mode 100644 index 000000000..95aa7a579 --- /dev/null +++ b/mod/locs.php @@ -0,0 +1,90 @@ +<?php /** @file */ + + +/** + Placeholder file at present. This is going to involve a bit of work. + + This file will deal with the deletion of channels and management of hublocs. + + We need to provide the following functionality: + + - Delete my account and all channels from the entire network + + - Delete my account and all channels from this server + + - Delete a channel from the entire network + + - Delete a channel from this server + + - List all hub locations for this channel + + - Remove this/some hub location from this channel + + - promote this/some hub location to primary + + - Remove hub location 'xyz' from this channel, (this should possibly only be allowed if that hub has been down for a period of time) + + - Some of these actions should probably require email verification + +*/ + + +function locs_post(&$a) { + + if(! local_user()) + return; + + $channel = $a->get_channel(); + + if($_REQUEST['primary']) { + $hubloc_id = intval($_REQUEST['primary']); + if($hubloc_id) { + $r = q("select hubloc_id from hubloc where hubloc_id = %d and hubloc_hash = '%s' limit 1", + intval($hubloc_id), + dbesc($channel['channel_hash']) + ); + if(! $r) { + notice( t('Location not found.') . EOL); + return; + } + $r = q("update hubloc set hubloc_flags = (hubloc_flags ^ %d) where (hubloc_flags & %d) and hubloc_hash = '%s' ", + intval(HUBLOC_FLAGS_PRIMARY), + intval(HUBLOC_FLAGS_PRIMARY), + dbesc($channel['channel_hash']) + ); + $r = q("update hubloc set hubloc_flags = (hubloc_flags & %d) where hubloc_id = %d and hubloc_hash = '%s' limit 1", + intval(HUBLOC_FLAGS_PRIMARY), + intval($hubloc_id), + dbesc($channel['channel_hash']) + ); + proc_run('php','include/notifier.php','location',$channel['channel_id']); + return; + } + } + + if($_REQUEST['drop']) { + $hubloc_id = intval($_REQUEST['drop']); + if($hubloc_id) { + $r = q("select hubloc_id, hubloc_flags from hubloc where hubloc_id = %d and hubloc_url != '%s' and hubloc_hash = '%s' limit 1", + intval($hubloc_id), + dbesc(z_root()), + dbesc($channel['channel_hash']) + ); + if(! $r) { + notice( t('Location not found.') . EOL); + return; + } + if($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) { + notice( t('Primary location cannot be removed.') . EOL); + return; + } + $r = q("update hubloc set hubloc_flags = (hubloc_flags & %d) where hubloc_id = %d and hubloc_hash = '%s' limit 1", + intval(HUBLOC_FLAGS_DELETED), + intval($hubloc_id), + dbesc($channel['channel_hash']) + ); + proc_run('php','include/notifier.php','location',$channel['channel_id']); + return; + } + } +}
\ No newline at end of file diff --git a/mod/page.php b/mod/page.php index b3f53a227..e8f17ebda 100644 --- a/mod/page.php +++ b/mod/page.php @@ -14,13 +14,11 @@ function page_init(&$a) { if($a->profile['profile_uid']) head_set_icon($a->profile['thumb']); -} - + // load the item here in the init function because we need to extract + // the page layout and initialise the correct theme. -function page_content(&$a) { - $observer = $a->get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); @@ -97,11 +95,27 @@ function page_content(&$a) { } } + $a->data['webpage'] = $r; + + + +} + + + + +function page_content(&$a) { + + $r = $a->data['webpage']; + if(! $r) + return; // logger('layout: ' . print_r($a->layout,true)); // Use of widgets should be determined by Comanche, but we don't have it on system pages yet, so... + // I recommend we now get rid of this bit - it's quite a hack to work around... - mike + if ($perms['write_pages']) { $chan = $a->channel['channel_id']; $who = $channel_address; diff --git a/mod/photos.php b/mod/photos.php index dc593f22b..d1f2b4993 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -319,6 +319,7 @@ function photos_post(&$a) { $old_inform = $r[0]['inform']; } + // make sure the linked item has the same permissions as the photo regardless of any other changes $x = q("update item set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', item_private = %d where id = %d limit 1", @@ -380,6 +381,7 @@ function photos_post(&$a) { if($success['replaced']) { $tagged[] = $tag; + $post_tags[] = array( 'uid' => $a->profile['profile_uid'], 'type' => $success['termtype'], @@ -397,8 +399,14 @@ function photos_post(&$a) { ); if($r) { + $r = fetch_post_tags($r,true); $datarray = $r[0]; - $datarray['term'] = $post_tags; + if($post_tags) { + if((! array_key_exists('term',$datarray)) || (! is_array($datarray['term']))) + $datarray['term'] = $post_tags; + else + $datarray['term'] = array_merge($datarray['term'],$post_tags); + } item_store_update($datarray,$execflag); } @@ -468,11 +476,9 @@ function photos_content(&$a) { if(argc() > 3) { $datatype = argv(2); $datum = argv(3); - } - elseif((argc() > 2) && (argv(2) === 'upload')) - $datatype = 'upload'; - else + } else { $datatype = 'summary'; + } if(argc() > 4) $cmd = argv(4); @@ -495,7 +501,6 @@ function photos_content(&$a) { $can_post = perm_is_allowed($owner_uid,$observer['xchan_hash'],'post_photos'); $can_view = perm_is_allowed($owner_uid,$observer['xchan_hash'],'view_photos'); - if(! $can_view) { notice( t('Access to this item is restricted.') . EOL); return; @@ -521,34 +526,7 @@ function photos_content(&$a) { * Display upload form */ - if($datatype === 'upload') { - if(! ($can_post)) { - notice( t('Permission denied.')); - return; - } - - - - if(array_key_exists('albums', $a->data)) - $albums = get_app()->data['albums']; - else - $albums = photos_albums_list($a->data['channel'],$a->data['observer']); - - - $selname = (($datum) ? hex2bin($datum) : ''); - $albumselect = '<select id="photos-upload-album-select" name="album" size="4">'; - - $albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '> </option>'; - if(count($albums['albums'])) { - foreach($albums['albums'] as $album) { - if(! $album['text']) - continue; - $selected = (($selname === $album['text']) ? ' selected="selected" ' : ''); - $albumselect .= '<option value="' . $album['text'] . '"' . $selected . '>' . $album['text'] . '</option>'; - } - } - - $albumselect .= '</select>'; + if( $can_post) { $uploader = ''; @@ -556,12 +534,8 @@ function photos_content(&$a) { 'addon_text' => $uploader, 'default_upload' => true); - call_hooks('photo_upload_form',$ret); - $default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" > - <input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>'; - /* Show space usage */ $r = q("select sum(size) as total from photo where aid = %d and scale = 0 ", @@ -571,10 +545,10 @@ function photos_content(&$a) { $limit = service_class_fetch($a->data['channel']['channel_id'],'photo_upload_limit'); if($limit !== false) { - $usage_message = sprintf( t("You have used %1$.2f Mbytes of %2$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000 ); + $usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 ); } else { - $usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 ); + $usage_message = sprintf( t('%1$.2f MB photo storage used.'), $r[0]['total'] / 1024000 ); } if($_is_owner) { @@ -588,28 +562,32 @@ function photos_content(&$a) { ); } - $albumselect_e = $albumselect; $aclselect_e = (($_is_owner) ? populate_acl($channel_acl,false) : ''); + $selname = (($datum) ? hex2bin($datum) : ''); + + $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $tpl = get_markup_template('photos_upload.tpl'); - $o .= replace_macros($tpl,array( + $upload_form = replace_macros($tpl,array( '$pagename' => t('Upload Photos'), '$sessid' => session_id(), '$usage' => $usage_message, '$nickname' => $a->data['channel']['channel_address'], - '$newalbum' => t('New album name: '), - '$existalbumtext' => t('or existing album name: '), + '$newalbum_label' => t('Enter a new album name'), + '$newalbum_placeholder' => t('or select an existing one (doubleclick)'), '$nosharetext' => t('Do not show a status post for this upload'), - '$albumselect' => $albumselect_e, + '$albums' => $albums['albums'], + '$selname' => $selname, '$permissions' => t('Permissions'), '$aclselect' => $aclselect_e, '$uploader' => $ret['addon_text'], - '$default' => (($ret['default_upload']) ? $default_upload : ''), - '$uploadurl' => $ret['post_url'] + '$default' => (($ret['default_upload']) ? true : false), + '$uploadurl' => $ret['post_url'], + '$submit' => t('Submit') )); - return $o; } /* @@ -653,33 +631,27 @@ function photos_content(&$a) { intval($a->pager['itemspage']) ); - if($cmd === 'edit') { - if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { - if($can_post) { - if($a->get_template_engine() === 'internal') { - $album_e = template_escape($album); - } - else { - $album_e = $album; - } - - $edit_tpl = get_markup_template('album_edit.tpl'); - $o .= replace_macros($edit_tpl,array( - '$nametext' => t('New album name: '), - '$nickname' => $a->data['channel']['channel_address'], - '$album' => $album_e, - '$hexalbum' => bin2hex($album), - '$submit' => t('Submit'), - '$dropsubmit' => t('Delete Album') - )); + //edit album name + $album_edit = null; + if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { + if($can_post) { + if($a->get_template_engine() === 'internal') { + $album_e = template_escape($album); } - } - } - else { - if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { - if($can_post) { - $edit = array(t('Edit Album'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '/edit'); - } + else { + $album_e = $album; + } + $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $edit_tpl = get_markup_template('album_edit.tpl'); + $album_edit = replace_macros($edit_tpl,array( + '$nametext' => t('New album name: '), + '$nickname' => $a->data['channel']['channel_address'], + '$album' => $album_e, + '$albums' => $albums['albums'], + '$hexalbum' => bin2hex($album), + '$submit' => t('Submit'), + '$dropsubmit' => t('Delete Album') + )); } } @@ -719,6 +691,7 @@ function photos_content(&$a) { 'desc'=> $desc_e, 'ext' => $ext, 'hash'=> $rr['resource_id'], + 'unknown' => t('Unknown') ); } } @@ -741,10 +714,12 @@ function photos_content(&$a) { $o .= replace_macros($tpl, array( '$photos' => $photos, '$album' => $album, + '$album_edit' => array(t('Edit Album'), $album_edit), '$can_post' => $can_post, '$upload' => array(t('Upload'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album)), '$order' => $order, - '$edit' => $edit + '$upload_form' => $upload_form, + '$usage' => $usage_message )); } @@ -855,16 +830,14 @@ function photos_content(&$a) { $tools = array( 'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')), ); - - // lock - $lock = ( ( ($ph[0]['uid'] == local_user()) && (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid']) - || strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid'])) ) - ? t('Private Message') - : Null); - - } + // lock + $lock = ( ( (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid']) + || strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid'])) ) + ? t('Private Photo') + : Null); + $a->page['htmlhead'] .= '<script>$(document).keydown(function(event) {' . "\n"; if($prevlink) $a->page['htmlhead'] .= 'if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = \'' . $prevlink . '\'; }' . "\n"; @@ -873,7 +846,7 @@ function photos_content(&$a) { $a->page['htmlhead'] .= '});</script>'; if($prevlink) - $prevlink = array($prevlink, '<i class="icon-backward photo-icons""></i>') ; + $prevlink = array($prevlink, t('Previous')); $photo = array( 'href' => $a->get_baseurl() . '/photo/' . $hires['resource_id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']], @@ -882,7 +855,7 @@ function photos_content(&$a) { ); if($nextlink) - $nextlink = array($nextlink, '<i class="icon-forward photo-icons"></i>'); + $nextlink = array($nextlink, t('Next')); // Do we have an item for this photo? @@ -912,21 +885,19 @@ function photos_content(&$a) { $r = conv_sort($r,'commented'); } - - $tags = array(); if($link_item['term']) { $cnt = 0; - foreach($link_item['term'] as $t) + foreach($link_item['term'] as $t) { $tags[$cnt] = array(0 => format_term_for_display($t)); if($can_post && ($ph[0]['uid'] == $owner_uid)) { - $tags[$cnt][1] = 'tagrm?f=&item=' . $link_item['id']; + $tags[$cnt][1] = 'tagrm/drop/' . $link_item['id'] . '/' . bin2hex($t['term']); //?f=&item=' . $link_item['id']; $tags[$cnt][2] = t('Remove'); } $cnt ++; + } } - if((local_user()) && (local_user() == $link_item['uid'])) { q("UPDATE `item` SET item_flags = (item_flags ^ %d) WHERE parent = %d and uid = %d and (item_flags & %d)", intval(ITEM_UNSEEN), @@ -945,18 +916,14 @@ function photos_content(&$a) { $edit = null; if($can_post) { - if(array_key_exists('albums', $a->data)) - $albums = get_app()->data['albums']; - else - $albums = photos_albums_list($a->data['channel'],$a->data['observer']); - $album_e = $ph[0]['album']; $caption_e = $ph[0]['description']; $aclselect_e = populate_acl($ph[0]); + $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); $edit = array( 'edit' => t('Edit photo'), - 'id' => $ph[0]['id'], + 'id' => $link_item['id'], 'rotatecw' => t('Rotate CW (right)'), 'rotateccw' => t('Rotate CCW (left)'), 'albums' => $albums['albums'], @@ -969,7 +936,7 @@ function photos_content(&$a) { 'tag_label' => t('Add a Tag'), 'permissions' => t('Permissions'), 'aclselect' => $aclselect_e, - 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'), + 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com'), 'item_id' => ((count($linked_items)) ? $link_item['id'] : 0), 'submit' => t('Submit'), 'delete' => t('Delete Photo') @@ -999,7 +966,7 @@ function photos_content(&$a) { $comments = ''; if(! count($r)) { if($can_post || $can_comment) { - $comments .= replace_macros($cmnt_tpl,array( + $commentbox = replace_macros($cmnt_tpl,array( '$return_path' => '', '$mode' => 'photos', '$jsreload' => $return_url, @@ -1025,7 +992,7 @@ function photos_content(&$a) { $like = ''; $dislike = ''; - // display comments + if($r) { foreach($r as $item) { @@ -1033,10 +1000,33 @@ function photos_content(&$a) { like_puller($a,$item,$dlike,'dislike'); } - $like = ((isset($alike[$link_item['id']])) ? format_like($alike[$link_item['id']],$alike[$link_item['id'] . '-l'],'like',$link_item['id']) : ''); - $dislike = ((isset($dlike[$link_item['id']])) ? format_like($dlike[$link_item['id']],$dlike[$link_item['id'] . '-l'],'dislike',$link_item['id']) : ''); + $like_count = ((x($alike,$link_item['mid'])) ? $alike[$link_item['mid']] : ''); + $like_list = ((x($alike,$link_item['mid'])) ? $alike[$link_item['mid'] . '-l'] : ''); + if (count($like_list) > MAX_LIKERS) { + $like_list_part = array_slice($like_list, 0, MAX_LIKERS); + array_push($like_list_part, '<a href="#" data-toggle="modal" data-target="#likeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>'); + } else { + $like_list_part = ''; + } + $like_button_label = tt('Like','Likes',$like_count,'noun'); + + //if (feature_enabled($conv->get_profile_owner(),'dislike')) { + $dislike_count = ((x($dlike,$link_item['mid'])) ? $dlike[$link_item['mid']] : ''); + $dislike_list = ((x($dlike,$link_item['mid'])) ? $dlike[$link_item['mid'] . '-l'] : ''); + $dislike_button_label = tt('Dislike','Dislikes',$dislike_count,'noun'); + if (count($dislike_list) > MAX_LIKERS) { + $dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS); + array_push($dislike_list_part, '<a href="#" data-toggle="modal" data-target="#dislikeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>'); + } else { + $dislike_list_part = ''; + } + //} + + $like = ((isset($alike[$link_item['mid']])) ? format_like($alike[$link_item['mid']],$alike[$link_item['mid'] . '-l'],'like',$link_item['mid']) : ''); + $dislike = ((isset($dlike[$link_item['mid']])) ? format_like($dlike[$link_item['mid']],$dlike[$link_item['mid'] . '-l'],'dislike',$link_item['mid']) : ''); + // display comments foreach($r as $item) { $comment = ''; @@ -1070,7 +1060,7 @@ function photos_content(&$a) { $body_e = prepare_text($item['body'],$item['mimetype']); $comments .= replace_macros($template,array( - '$id' => $item['item_id'], + '$id' => $item['id'], '$mode' => 'photos', '$profile_url' => $profile_link, '$name' => $name_e, @@ -1079,7 +1069,7 @@ function photos_content(&$a) { '$title' => $title_e, '$body' => $body_e, '$ago' => relative_date($item['created']), - '$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''), + '$indent' => (($item['parent'] != $item['id']) ? ' comment' : ''), '$drop' => $drop, '$comment' => $comment )); @@ -1087,7 +1077,7 @@ function photos_content(&$a) { } if($can_post || $can_comment) { - $comments .= replace_macros($cmnt_tpl,array( + $commentbox = replace_macros($cmnt_tpl,array( '$return_path' => '', '$jsreload' => $return_url, '$type' => 'wall-comment', @@ -1114,7 +1104,7 @@ function photos_content(&$a) { $photo_tpl = get_markup_template('photo_view.tpl'); $o .= replace_macros($photo_tpl, array( - '$id' => $ph[0]['id'], + '$id' => $link_item['id'], //$ph[0]['id'], '$album' => $album_e, '$tools' => $tools, '$lock' => $lock, @@ -1122,13 +1112,27 @@ function photos_content(&$a) { '$prevlink' => $prevlink, '$nextlink' => $nextlink, '$desc' => $ph[0]['description'], + '$filename' => $ph[0]['filename'], + '$unknown' => t('Unknown'), '$tag_hdr' => t('In This Photo:'), '$tags' => $tags, '$edit' => $edit, '$likebuttons' => $likebuttons, '$like' => $like_e, '$dislike' => $dislike_e, + '$like_count' => $like_count, + '$like_list' => $like_list, + '$like_list_part' => $like_list_part, + '$like_button_label' => $like_button_label, + '$like_modal_title' => t('Likes','noun'), + '$dislike_modal_title' => t('Dislikes','noun'), + '$dislike_count' => $dislike_count, //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_count : ''), + '$dislike_list' => $dislike_list, //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list : ''), + '$dislike_list_part' => $dislike_list_part, //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list_part : ''), + '$dislike_button_label' => $dislike_button_label, //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_button_label : ''), + '$modal_dismiss' => t('Close'), '$comments' => $comments, + '$commentbox' => $commentbox, '$paginate' => $paginate, )); @@ -1224,6 +1228,8 @@ function photos_content(&$a) { '$can_post' => $can_post, '$upload' => array(t('Upload'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'), '$photos' => $photos, + '$upload_form' => $upload_form, + '$usage' => $usage_message )); } diff --git a/mod/post.php b/mod/post.php index d62233ca1..c21af83e4 100644 --- a/mod/post.php +++ b/mod/post.php @@ -507,6 +507,7 @@ function post_post(&$a) { json_return_and_die($ret); } + if($msgtype === 'pickup') { /** @@ -597,11 +598,24 @@ function post_post(&$a) { $ret['success'] = true; $ret['pickup'] = array(); foreach($r as $rr) { - $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => json_decode($rr['outq_msg'],true)); + if($rr['outq_msg']) { + $x = json_decode($rr['outq_msg'],true); - $x = q("delete from outq where outq_hash = '%s' limit 1", - dbesc($rr['outq_hash']) - ); + if(! $x) + continue; + + if(array_key_exists('message_list',$x)) { + foreach($x['message_list'] as $xx) { + $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $xx); + } + } + else + $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $x); + + $x = q("delete from outq where outq_hash = '%s' limit 1", + dbesc($rr['outq_hash']) + ); + } } } @@ -796,6 +810,12 @@ function post_post(&$a) { json_return_and_die($ret); } + if($msgtype === 'request') { + // request a particular post/conversation by message_id + $x = zot_process_message_request($data); + json_return_and_die($x); + } + if($msgtype === 'purge') { if($recipients) { diff --git a/mod/profiles.php b/mod/profiles.php index 5d0416e9a..14f24c5cf 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -233,41 +233,13 @@ function profiles_post(&$a) { return; } - if($_POST['dob']) { - $year = substr($_POST['dob'],0,4); - $month = substr($_POST['dob'],5,2); - $day = substr($_POST['dob'],8,2); - } - - $year = intval($_POST['year']); - if($year < 1900 || $year > 2100 || $year < 0) - $year = 0; - $month = intval($_POST['month']); - if(($month > 12) || ($month < 0)) - $month = 0; - $mtab = array(0,31,29,31,30,31,30,31,31,30,31,30,31); - $day = intval($_POST['day']); - if(($day > $mtab[$month]) || ($day < 0)) - $day = 0; - -// if($year && (! ($month && $day))) { -// $month = 1; $day = 1; -// } - - - $dob = '0000-00-00'; - $dob = sprintf('%04d-%02d-%02d',$year,$month,$day); - + $dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated? $name = escape_tags(trim($_POST['name'])); if($orig[0]['name'] != $name) $namechanged = true; - - - - $pdesc = escape_tags(trim($_POST['pdesc'])); $gender = escape_tags(trim($_POST['gender'])); $address = escape_tags(trim($_POST['address'])); @@ -654,7 +626,7 @@ logger('extra_fields: ' . print_r($extra_fields,true)); '$lbl_fullname' => t('Your Full Name:'), '$lbl_title' => t('Title/Description:'), '$lbl_gender' => t('Your Gender:'), - '$lbl_bd' => sprintf( t("Birthday \x28%s\x29:"),datesel_format($f)), + '$lbl_bd' => t("Birthday :"), '$lbl_address' => t('Street Address:'), '$lbl_city' => t('Locality/City:'), '$lbl_zip' => t('Postal/Zip Code:'), diff --git a/mod/settings.php b/mod/settings.php index 876216871..58257368e 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -39,7 +39,9 @@ function settings_post(&$a) { if(! local_user()) return; - // logger('mod_settings: ' . print_r($_REQUEST,true)); + $channel = $a->get_channel(); + + logger('mod_settings: ' . print_r($_REQUEST,true)); if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) return; @@ -152,14 +154,11 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','mobile_theme',$mobile_theme); } -// $chanview_full = ((x($_POST,'chanview_full')) ? intval($_POST['chanview_full']) : 0); set_pconfig(local_user(),'system','user_scalable',$user_scalable); set_pconfig(local_user(),'system','update_interval', $browser_update); set_pconfig(local_user(),'system','itemspage', $itemspage); set_pconfig(local_user(),'system','no_smilies',$nosmile); set_pconfig(local_user(),'system','title_tosource',$title_tosource); -// set_pconfig(local_user(),'system','chanview_full',$chanview_full); - if ($theme == $a->channel['channel_theme']){ // call theme_post only if theme has not been changed @@ -257,14 +256,108 @@ function settings_post(&$a) { call_hooks('settings_post', $_POST); - + $set_perms = ''; + + $role = ((x($_POST,'permissions_role')) ? notags(trim($_POST['permissions_role'])) : ''); + $oldrole = get_pconfig(local_user(),'system','permissions_role'); + + if(($role != $oldrole) || ($role === 'custom')) { + + if($role === 'custom') { + $hide_presence = (((x($_POST,'hide_presence')) && (intval($_POST['hide_presence']) == 1)) ? 1: 0); + $publish = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0); + $def_group = ((x($_POST,'group-selection')) ? notags(trim($_POST['group-selection'])) : ''); + $r = q("update channel set channel_default_group = '%s' where channel_id = %d limit 1", + dbesc($def_group), + intval(local_user()) + ); + + $global_perms = get_perms(); + + foreach($global_perms as $k => $v) { + $set_perms .= ', ' . $v[0] . ' = ' . intval($_POST[$k]) . ' '; + } + + $str_group_allow = perms2str($_POST['group_allow']); + $str_contact_allow = perms2str($_POST['contact_allow']); + $str_group_deny = perms2str($_POST['group_deny']); + $str_contact_deny = perms2str($_POST['contact_deny']); + $r = q("update channel set channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' + where channel_id = %d limit 1", + dbesc($str_contact_allow), + dbesc($str_group_allow), + dbesc($str_contact_deny), + dbesc($str_group_deny), + intval(local_user()) + ); + } + else { + $role_permissions = get_role_perms($_POST['permissions_role']); + if(! $role_permissions) { + notice('Permissions category could not be found.'); + return; + } + $hide_presence = 1 - (intval($role_permissions['online'])); + if($role_permissions['default_collection']) { + $r = q("select hash from groups where uid = %d and name = '%s' limit 1", + intval(local_user()), + dbesc( t('Friends') ) + ); + if(! $r) { + require_once('include/group.php'); + group_add(local_user(), t('Friends')); + group_add_member(local_user(),t('Friends'),$channel['channel_hash']); + $r = q("select hash from groups where uid = %d and name = '%s' limit 1", + intval(local_user()), + dbesc( t('Friends') ) + ); + } + if($r) { + q("update channel set channel_default_group = '%s', channel_allow_gid = '%s', channel_allow_cid = '', channel_deny_gid = '', channel_deny_cid = '' where channel_id = %d limit 1", + dbesc($r[0]['hash']), + dbesc('<' . $r[0]['hash'] . '>'), + intval(local_user()) + ); + } + else { + notice( sprintf('Default privacy collection \'%s\' not found. Please create and re-submit permission change.', t('Friends')) . EOL); + return; + } + } + // no default collection + else { + q("update channel set channel_default_group = '', channel_allow_gid = '', channel_allow_cid = '', channel_deny_gid = '', + channel_deny_cid = '' where channel_id = %d limit 1", + intval(local_user()) + ); + } + + $r = q("update abook set abook_my_perms = %d where abook_channel = %d and (abook_flags & %d) limit 1", + intval(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0), + intval(local_user()), + intval(ABOOK_FLAG_SELF) + ); + + foreach($role_permissions as $p => $v) { + if(strpos($p,'channel_') !== false) { + $set_perms .= ', ' . $p . ' = ' . intval($v) . ' '; + } + if($p === 'directory_publish') { + $publish = intval($v); + } + } + } + + set_pconfig(local_user(),'system','hide_online_status',$hide_presence); + set_pconfig(local_user(),'system','permissions_role',$role); + } + $username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : ''); $timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : ''); $defloc = ((x($_POST,'defloc')) ? notags(trim($_POST['defloc'])) : ''); $openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : ''); $maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0); $expire = ((x($_POST,'expire')) ? intval($_POST['expire']) : 0); - $def_group = ((x($_POST,'group-selection')) ? notags(trim($_POST['group-selection'])) : ''); $channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : ''); $expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0); @@ -273,17 +366,13 @@ function settings_post(&$a) { $expire_network_only = ((x($_POST,'expire_network_only'))? intval($_POST['expire_network_only']) : 0); $allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0); - $hide_presence = (((x($_POST,'hide_presence')) && (intval($_POST['hide_presence']) == 1)) ? 1: 0); - $publish = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0); - $page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); - $blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted! + $blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted! $unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0); $cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0); $suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0); - $hide_friends = (($_POST['hide_friends'] == 1) ? 1: 0); - $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); + $post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0); $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0); $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0); @@ -295,63 +384,6 @@ function settings_post(&$a) { if($adult != $existing_adult) $pageflags = ($pageflags ^ PAGE_ADULT); - $arr = array(); - $arr['channel_r_stream'] = (($_POST['view_stream']) ? $_POST['view_stream'] : 0); - $arr['channel_r_profile'] = (($_POST['view_profile']) ? $_POST['view_profile'] : 0); - $arr['channel_r_photos'] = (($_POST['view_photos']) ? $_POST['view_photos'] : 0); - $arr['channel_r_abook'] = (($_POST['view_contacts']) ? $_POST['view_contacts'] : 0); - $arr['channel_w_stream'] = (($_POST['send_stream']) ? $_POST['send_stream'] : 0); - $arr['channel_w_wall'] = (($_POST['post_wall']) ? $_POST['post_wall'] : 0); - $arr['channel_w_tagwall'] = (($_POST['tag_deliver']) ? $_POST['tag_deliver'] : 0); - $arr['channel_w_comment'] = (($_POST['post_comments']) ? $_POST['post_comments'] : 0); - $arr['channel_w_mail'] = (($_POST['post_mail']) ? $_POST['post_mail'] : 0); - $arr['channel_w_photos'] = (($_POST['post_photos']) ? $_POST['post_photos'] : 0); - $arr['channel_w_chat'] = (($_POST['chat']) ? $_POST['chat'] : 0); - $arr['channel_a_delegate'] = (($_POST['delegate']) ? $_POST['delegate'] : 0); - $arr['channel_r_storage'] = (($_POST['view_storage']) ? $_POST['view_storage'] : 0); - $arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0); - $arr['channel_r_pages'] = (($_POST['view_pages']) ? $_POST['view_pages'] : 0); - $arr['channel_w_pages'] = (($_POST['write_pages']) ? $_POST['write_pages'] : 0); - $arr['channel_a_republish'] = (($_POST['republish']) ? $_POST['republish'] : 0); - $arr['channel_w_like'] = (($_POST['post_like']) ? $_POST['post_like'] : 0); - - $defperms = 0; - if(x($_POST['def_view_stream'])) - $defperms += $_POST['def_view_stream']; - if(x($_POST['def_view_profile'])) - $defperms += $_POST['def_view_profile']; - if(x($_POST['def_view_photos'])) - $defperms += $_POST['def_view_photos']; - if(x($_POST['def_view_contacts'])) - $defperms += $_POST['def_view_contacts']; - if(x($_POST['def_send_stream'])) - $defperms += $_POST['def_send_stream']; - if(x($_POST['def_post_wall'])) - $defperms += $_POST['def_post_wall']; - if(x($_POST['def_tag_deliver'])) - $defperms += $_POST['def_tag_deliver']; - if(x($_POST['def_post_comments'])) - $defperms += $_POST['def_post_comments']; - if(x($_POST['def_post_mail'])) - $defperms += $_POST['def_post_mail']; - if(x($_POST['def_post_photos'])) - $defperms += $_POST['def_post_photos']; - if(x($_POST['def_chat'])) - $defperms += $_POST['def_chat']; - if(x($_POST['def_delegate'])) - $defperms += $_POST['def_delegate']; - if(x($_POST['def_view_storage'])) - $defperms += $_POST['def_view_storage']; - if(x($_POST['def_write_storage'])) - $defperms += $_POST['def_write_storage']; - if(x($_POST['def_view_pages'])) - $defperms += $_POST['def_view_pages']; - if(x($_POST['def_write_pages'])) - $defperms += $_POST['def_write_pages']; - if(x($_POST['def_republish'])) - $defperms += $_POST['def_republish']; - if(x($_POST['def_post_like'])) - $defperms += $_POST['def_post_like']; $notify = 0; @@ -372,7 +404,6 @@ function settings_post(&$a) { if(x($_POST,'notify8')) $notify += intval($_POST['notify8']); - $channel = $a->get_channel(); $err = ''; @@ -389,27 +420,20 @@ function settings_post(&$a) { } } - if($timezone != $channel['channel_timezone']) { if(strlen($timezone)) date_default_timezone_set($timezone); } - $str_group_allow = perms2str($_POST['group_allow']); - $str_contact_allow = perms2str($_POST['contact_allow']); - $str_group_deny = perms2str($_POST['group_deny']); - $str_contact_deny = perms2str($_POST['contact_deny']); - set_pconfig(local_user(),'system','use_browser_location',$allow_location); set_pconfig(local_user(),'system','suggestme', $suggestme); set_pconfig(local_user(),'system','post_newfriend', $post_newfriend); set_pconfig(local_user(),'system','post_joingroup', $post_joingroup); set_pconfig(local_user(),'system','post_profilechange', $post_profilechange); set_pconfig(local_user(),'system','blocktags',$blocktags); - set_pconfig(local_user(),'system','hide_online_status',$hide_presence); set_pconfig(local_user(),'system','channel_menu',$channel_menu); - $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_default_group = '%s', channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d, channel_a_republish = %d, channel_w_like = %d, channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d limit 1", + $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d limit 1", dbesc($username), intval($pageflags), dbesc($timezone), @@ -418,42 +442,17 @@ function settings_post(&$a) { intval($unkmail), intval($maxreq), intval($expire), - dbesc($def_group), - intval($arr['channel_r_stream']), - intval($arr['channel_r_profile']), - intval($arr['channel_r_photos']), - intval($arr['channel_r_abook']), - intval($arr['channel_w_stream']), - intval($arr['channel_w_wall']), - intval($arr['channel_w_tagwall']), - intval($arr['channel_w_comment']), - intval($arr['channel_w_mail']), - intval($arr['channel_w_photos']), - intval($arr['channel_w_chat']), - intval($arr['channel_a_delegate']), - intval($arr['channel_r_storage']), - intval($arr['channel_w_storage']), - intval($arr['channel_r_pages']), - intval($arr['channel_w_pages']), - intval($arr['channel_a_republish']), - intval($arr['channel_w_like']), - dbesc($str_contact_allow), - dbesc($str_group_allow), - dbesc($str_contact_deny), - dbesc($str_group_deny), intval(local_user()) ); if($r) info( t('Settings updated.') . EOL); - $r = q("UPDATE `profile` - SET `publish` = %d, - `hide_friends` = %d - WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", - intval($publish), - intval($hide_friends), - intval(local_user()) - ); + if(! is_null($publish)) { + $r = q("UPDATE profile SET publish = %d WHERE is_default = 1 AND uid = %d LIMIT 1", + intval($publish), + intval(local_user()) + ); + } if($name_change) { $r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s' where xchan_hash = '%s' limit 1", @@ -786,8 +785,6 @@ function settings_content(&$a) { require_once('include/permissions.php'); - - $p = q("SELECT * FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()) ); @@ -840,9 +837,8 @@ function settings_content(&$a) { $expire = $channel['channel_expire_days']; $adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT); - $blockwall = $a->user['blockwall']; - $unkmail = $a->user['unkmail']; - $cntunkmail = $a->user['cntunkmail']; +// $unkmail = $a->user['unkmail']; +// $cntunkmail = $a->user['cntunkmail']; $hide_presence = intval(get_pconfig(local_user(), 'system','hide_online_status')); @@ -880,8 +876,6 @@ function settings_content(&$a) { $timezone = date_default_timezone_get(); - - $opt_tpl = get_markup_template("field_yesno.tpl"); if(get_config('system','publish_all')) { $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />'; @@ -980,9 +974,10 @@ function settings_content(&$a) { '$permdesc' => t("\x28click to open/close\x29"), '$aclselect' => populate_acl($perm_defaults,false), '$suggestme' => $suggestme, - '$group_select' => $group_select, + '$role_lbl' => t('Channel permissions category:'), + '$role_select' => role_selector($permissions_role), '$profile_in_dir' => $profile_in_dir, '$hide_friends' => $hide_friends, diff --git a/mod/siteinfo.php b/mod/siteinfo.php index c1d65fadd..a58f17c53 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -88,8 +88,10 @@ function siteinfo_content(&$a) { if(! get_config('system','hidden_version_siteinfo')) { $version = sprintf( t('Version %s'), RED_VERSION ); - if(@is_dir('.git') && function_exists('shell_exec')) + if(@is_dir('.git') && function_exists('shell_exec')) { $commit = @shell_exec('git log -1 --format="%h"'); + $tag = @shell_exec('git describe --tags --abbrev=0'); + } if(! isset($commit) || strlen($commit) > 16) $commit = ''; } @@ -130,6 +132,7 @@ function siteinfo_content(&$a) { '$title' => t('Red'), '$description' => t('This is a hub of the Red Matrix - a global cooperative network of decentralized privacy enhanced websites.'), '$version' => $version, + '$tag' => $tag, '$commit' => $commit, '$web_location' => t('Running at web location') . ' ' . z_root(), '$visit' => t('Please visit <a href="http://getzot.com">GetZot.com</a> to learn more about the Red Matrix.'), diff --git a/mod/tagrm.php b/mod/tagrm.php index 957cf0d71..38787cb0b 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -19,24 +19,27 @@ function tagrm_post(&$a) { intval(local_user()) ); - if(! count($r)) + if(! $r) goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); - $arr = explode(',', $r[0]['tag']); - for($x = 0; $x < count($arr); $x ++) { - if($arr[$x] === $tag) { - unset($arr[$x]); - break; + $r = fetch_post_tags($r,true); + + $item = $r[0]; + $new_tags = array(); + + if($item['term']) { + for($x = 0; $x < count($item['term']); $x ++) { + if($item['term'][$x]['term'] !== hex2bin($tag)) + $new_tags[] = $item['term'][$x]; } } - $tag_str = implode(',',$arr); + if($new_tags) + $item['term'] = $new_tags; + else + unset($item['term']); - q("UPDATE `item` SET `tag` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", - dbesc($tag_str), - intval($item), - intval(local_user()) - ); + item_store_update($item); info( t('Tag removed') . EOL ); goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); @@ -49,51 +52,90 @@ function tagrm_post(&$a) { function tagrm_content(&$a) { - $o = ''; - if(! local_user()) { goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); // NOTREACHED } - $item = (($a->argc > 1) ? intval($a->argv[1]) : 0); - if(! $item) { + // remove tag on the fly if item and tag are provided + if((argc() == 4) && (argv(1) === 'drop') && intval(argv(2))) { + + $item = intval(argv(2)); + $tag = argv(3); + + $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($item), + intval(local_user()) + ); + + if(! $r) + goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + + $r = fetch_post_tags($r,true); + + $item = $r[0]; + + $new_tags = array(); + + if($item['term']) { + for($x = 0; $x < count($item['term']); $x ++) { + if($item['term'][$x]['term'] !== hex2bin($tag)) + $new_tags[] = $item['term'][$x]; + } + } + + if($new_tags) + $item['term'] = $new_tags; + else + unset($item['term']); + + item_store_update($item); + + info( t('Tag removed') . EOL ); goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); - // NOTREACHED + } + //if we got only the item print a list of tags to select + if((argc() == 3) && (argv(1) === 'drop') && intval(argv(2))) { - $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($item), - intval(local_user()) - ); + $o = ''; - if(! count($r)) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + $item = intval(argv(2)); - $arr = explode(',', $r[0]['tag']); + $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($item), + intval(local_user()) + ); - if(! count($arr)) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + if(! $r) + goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); - $o .= '<h3>' . t('Remove Item Tag') . '</h3>'; + $r = fetch_post_tags($r,true); - $o .= '<p id="tag-remove-desc">' . t('Select a tag to remove: ') . '</p>'; + if(! count($r[0]['term'])) + goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); - $o .= '<form id="tagrm" action="tagrm" method="post" >'; - $o .= '<input type="hidden" name="item" value="' . $item . '" />'; - $o .= '<ul>'; + $o .= '<h3>' . t('Remove Item Tag') . '</h3>'; + $o .= '<p id="tag-remove-desc">' . t('Select a tag to remove: ') . '</p>'; - foreach($arr as $x) { - $o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x) . '" >' . bbcode($x) . '</input></li>'; - } + $o .= '<form id="tagrm" action="tagrm" method="post" >'; + $o .= '<input type="hidden" name="item" value="' . $item . '" />'; + $o .= '<ul>'; - $o .= '</ul>'; - $o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . t('Remove') .'" />'; - $o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . t('Cancel') .'" />'; - $o .= '</form>'; - return $o; + foreach($r[0]['term'] as $x) { + $o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x['term']) . '" >' . bbcode($x['term']) . '</input></li>'; + } + + $o .= '</ul>'; + $o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . t('Remove') .'" />'; + $o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . t('Cancel') .'" />'; + $o .= '</form>'; + + return $o; + + } } diff --git a/mod/webpages.php b/mod/webpages.php index 2c3cc36ea..a5cfd00e6 100644 --- a/mod/webpages.php +++ b/mod/webpages.php @@ -81,9 +81,6 @@ function webpages_content(&$a) { require_once('include/conversation.php'); $o = profile_tabs($a,true); - $o .= '<div class="generic-content-wrapper-styled">'; - - $o .= '<h2>' . t('Webpages') . '</h2>'; $x = array( 'webpage' => ITEM_WEBPAGE, @@ -129,6 +126,7 @@ function webpages_content(&$a) { $url = z_root() . "/editwebpage/" . $which; // This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM). return $o . replace_macros(get_markup_template("webpagelist.tpl"), array( + '$listtitle' => t('Webpages'), '$baseurl' => $url, '$edit' => t('Edit'), '$pages' => $pages, diff --git a/mod/zotfeed.php b/mod/zotfeed.php index 480e886cd..c730e4162 100644 --- a/mod/zotfeed.php +++ b/mod/zotfeed.php @@ -38,7 +38,7 @@ function zotfeed_init(&$a) { logger('zotfeed request: ' . $r[0]['channel_name'], LOGGER_DEBUG); - $result['messages'] = zot_feed($r[0]['channel_id'],$observer['xchan_hash'],$mindate); + $result['messages'] = zot_feed($r[0]['channel_id'],$observer['xchan_hash'],array('mindate' => $mindate)); $result['success'] = true; json_return_and_die($result); |