diff options
author | marijus <mario@localhost.localdomain> | 2014-02-05 13:43:16 +0100 |
---|---|---|
committer | marijus <mario@localhost.localdomain> | 2014-02-05 13:43:16 +0100 |
commit | 9e993bb4fd7e6ff6ba44586479371c163ee6aad8 (patch) | |
tree | d3754aa1d251308eb6178fe4ab138463ceaaf135 /mod | |
parent | 4253581733d4c6c7f0dce5c3ea7566c6af4af936 (diff) | |
parent | 0844110f7b154a0fb5102362fe732c2b091222d7 (diff) | |
download | volse-hubzilla-9e993bb4fd7e6ff6ba44586479371c163ee6aad8.tar.gz volse-hubzilla-9e993bb4fd7e6ff6ba44586479371c163ee6aad8.tar.bz2 volse-hubzilla-9e993bb4fd7e6ff6ba44586479371c163ee6aad8.zip |
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'mod')
-rw-r--r-- | mod/bookmarks.php | 81 | ||||
-rw-r--r-- | mod/item.php | 4 | ||||
-rw-r--r-- | mod/menu.php | 5 | ||||
-rw-r--r-- | mod/parse_url.php | 2 | ||||
-rw-r--r-- | mod/settings.php | 6 |
5 files changed, 93 insertions, 5 deletions
diff --git a/mod/bookmarks.php b/mod/bookmarks.php new file mode 100644 index 000000000..de30d9bb6 --- /dev/null +++ b/mod/bookmarks.php @@ -0,0 +1,81 @@ +<?php + +function bookmarks_init(&$a) { + if(! local_user()) + return; + $item_id = intval($_REQUEST['item']); + if(! $item_id) + return; + + $u = $a->get_channel(); + + $i = q("select * from item where id = %d and uid = %d limit 1", + intval($item_id), + intval(local_user()) + ); + + if(! $i) + return; + + $i = fetch_post_tags($i); + + $item = $i[0]; + + $terms = get_terms_oftype($item['term'],TERM_BOOKMARK); + + if($terms && (! $item['item_restrict'])) { + require_once('include/bookmarks.php'); + + $s = q("select * from xchan where xchan_hash = '%s' limit 1", + dbesc($item['author_xchan']) + ); + if(! $s) { + logger('mod_bookmarks: author lookup failed.'); + killme(); + } + foreach($terms as $t) { + bookmark_add($u,$s[0],$t,$item['item_private']); + notice( t('Bookmark added') . EOL); + } + } + killme(); +} + +function bookmarks_content(&$a) { + if(! local_user()) { + notice( t('Permission denied.') . EOL); + return; + } + + + require_once('include/menu.php'); + + $o = '<h3>' . t('My Bookmarks') . '</h3>'; + + $x = menu_list(local_user(),'',MENU_BOOKMARK); + + if($x) { + foreach($x as $xx) { + $y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash()); + $o .= menu_render($y); + } + } + + $o .= '<h3>' . t('My Connections Bookmarks') . '</h3>'; + + + $x = menu_list(local_user(),'',MENU_SYSTEM|MENU_BOOKMARK); + + if($x) { + foreach($x as $xx) { + $y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash()); + $o .= menu_render($y); + } + } + + + + return $o; + +} + diff --git a/mod/item.php b/mod/item.php index 68bb75897..c8c0e3762 100644 --- a/mod/item.php +++ b/mod/item.php @@ -896,9 +896,9 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) { //is it a hash tag? if(strpos($tag,'#') === 0) { if(strpos($tag,'#^[') === 0) { - if(preg_match('/#\^\[(url|zrl)=(.*?)\](.*?)\[\/(url|zrl)\]/',$tag,$match)) { + if(preg_match('/#\^\[(url|zrl)(.*?)\](.*?)\[\/(url|zrl)\]/',$tag,$match)) { $basetag = $match[3]; - $url = $match[2]; + $url = ((substr($match[2],0,1) === '=') ? substr($match[2],1) : $match[3]); $replaced = true; } diff --git a/mod/menu.php b/mod/menu.php index dd8fe8300..a2d0c2385 100644 --- a/mod/menu.php +++ b/mod/menu.php @@ -9,7 +9,9 @@ function menu_post(&$a) { $_REQUEST['menu_channel_id'] = local_user(); if($_REQUEST['menu_bookmark']) - $_REQUEST['menu_flags'] = MENU_BOOKMARK; + $_REQUEST['menu_flags'] |= MENU_BOOKMARK; + if($_REQUEST['menu_system']) + $_REQUEST['menu_flags'] |= MENU_SYSTEM; $menu_id = ((argc() > 1) ? intval(argv(1)) : 0); if($menu_id) { @@ -108,6 +110,7 @@ function menu_content(&$a) { '$menu_name' => array('menu_name', t('Menu name'), $m['menu_name'], t('Must be unique, only seen by you'), '*'), '$menu_desc' => array('menu_desc', t('Menu title'), $m['menu_desc'], t('Menu title as seen by others'), ''), '$menu_bookmark' => array('menu_bookmark', t('Allow bookmarks'), (($m['menu_flags'] & MENU_BOOKMARK) ? 1 : 0), t('Menu may be used to store saved bookmarks'), ''), + '$menu_system' => (($m['menu_flags'] & MENU_SYSTEM) ? 1 : 0), '$submit' => t('Modify') )); return $o; diff --git a/mod/parse_url.php b/mod/parse_url.php index c206c24ec..340e1a67e 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -252,7 +252,7 @@ function parse_url_content(&$a) { logger('parse_url: ' . $url); - $template = $br . '[url=%s]%s[/url]%s' . $br; + $template = $br . '#^[url=%s]%s[/url]%s' . $br; $arr = array('url' => $url, 'text' => ''); diff --git a/mod/settings.php b/mod/settings.php index 38b1d6fdf..7889538f3 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -306,6 +306,7 @@ function settings_post(&$a) { $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_a_bookmark'] = (($_POST['bookmark']) ? $_POST['bookmark'] : 0); $defperms = 0; if(x($_POST['def_view_stream'])) @@ -342,6 +343,8 @@ function settings_post(&$a) { $defperms += $_POST['def_write_pages']; if(x($_POST['def_republish'])) $defperms += $_POST['def_republish']; + if(x($_POST['def_bookmark'])) + $defperms += $_POST['def_bookmark']; $notify = 0; @@ -399,7 +402,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','hide_online_status',$hide_presence); - $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_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, 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_a_bookmark = %d, channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d limit 1", dbesc($username), intval($pageflags), dbesc($timezone), @@ -426,6 +429,7 @@ function settings_post(&$a) { intval($arr['channel_r_pages']), intval($arr['channel_w_pages']), intval($arr['channel_a_republish']), + intval($arr['channel_a_bookmark']), dbesc($str_contact_allow), dbesc($str_group_allow), dbesc($str_contact_deny), |