aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot.php2
-rw-r--r--database.sql1
-rw-r--r--include/items.php7
-rw-r--r--library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js2
-rw-r--r--mod/item.php17
-rw-r--r--mod/network.php10
-rw-r--r--mod/parse_url.php8
-rw-r--r--update.php7
-rw-r--r--view/theme/loozah/style.css3
9 files changed, 48 insertions, 9 deletions
diff --git a/boot.php b/boot.php
index 7534046f2..a196ccadc 100644
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once("include/pgettext.php");
define ( 'FRIENDIKA_VERSION', '2.2.1093' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
-define ( 'DB_UPDATE_VERSION', 1086 );
+define ( 'DB_UPDATE_VERSION', 1087 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/database.sql b/database.sql
index 343d4c497..ff339929e 100644
--- a/database.sql
+++ b/database.sql
@@ -206,6 +206,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`pubmail` tinyint(1) NOT NULL DEFAULT '0',
`visible` tinyint(1) NOT NULL DEFAULT '0',
`starred` tinyint(1) NOT NULL DEFAULT '0',
+ `bookmark` tinyint(1) NOT NULL DEFAULT '0',
`unseen` tinyint(1) NOT NULL DEFAULT '1',
`deleted` tinyint(1) NOT NULL DEFAULT '0',
`last-child` tinyint(1) unsigned NOT NULL DEFAULT '1',
diff --git a/include/items.php b/include/items.php
index 6ded6f87c..facd8b2d4 100644
--- a/include/items.php
+++ b/include/items.php
@@ -378,6 +378,10 @@ function get_atom_elements($feed,$item) {
if($dguid)
$res['guid'] = unxmlify($dguid[0]['data']);
+ $bm = $item->get_item_tags(NAMESPACE_DFRN,'bookmark');
+ if($bm)
+ $res['bookmark'] = ((unxmlify($bm[0]['data']) === 'true') ? 1 : 0);
+
/**
* If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
@@ -733,6 +737,7 @@ function item_store($arr,$force_parent = false) {
$arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : '');
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0 );
+ $arr['bookmark'] = ((x($arr,'bookmark')) ? intval($arr['bookmark']) : 0 );
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
$arr['tag'] = ((x($arr,'tag')) ? notags(trim($arr['tag'])) : '');
$arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : '');
@@ -1706,6 +1711,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
if($item['extid'])
$o .= '<dfrn:extid>' . xmlify($item['extid']) . '</dfrn:extid>' . "\r\n";
+ if($item['bookmark'])
+ $o .= '<dfrn:bookmark>true</dfrn:bookmark>' . "\r\n";
if($item['app'])
$o .= '<statusnet:notice_info local_id="' . $item['id'] . '" source="' . xmlify($item['app']) . '" ></statusnet:notice_info>' . "\r\n";
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
index db676cd90..789e75c39 100644
--- a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
+++ b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
@@ -70,6 +70,7 @@
// example: <strong> to [b]
+ rep(/<a class=\"bookmark\" href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[bookmark=$1]$2[/bookmark]");
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");
rep(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");
@@ -119,6 +120,7 @@
rep(/\[\/i\]/gi,"</em>");
rep(/\[u\]/gi,"<u>");
rep(/\[\/u\]/gi,"</u>");
+ rep(/\[bookmark=([^\]]+)\](.*?)\[\/bookmark\]/gi,"<a class=\"bookmark\" href=\"$1\">$2</a>");
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />");
diff --git a/mod/item.php b/mod/item.php
index 6ecca8f4a..b4ec7666f 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -332,6 +332,15 @@ function item_post(&$a) {
}
}
+ // embedded bookmark in post? convert to regular url and set bookmark flag
+
+ $bookmark = 0;
+ if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",$body,$match)) {
+ $bookmark = 1;
+ $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",'[url=$1]$2[/url]',$body);
+ }
+
+
/**
* Fold multi-line [code] sequences
*/
@@ -509,6 +518,7 @@ function item_post(&$a) {
$datarray['private'] = $private;
$datarray['pubmail'] = $pubmail_enable;
$datarray['attach'] = $attachments;
+ $datarray['bookmark'] = intval($bookmark);
$datarray['thr-parent'] = $thr_parent;
/**
@@ -551,8 +561,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
- `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` )
- VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s' )",
+ `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark` )
+ VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -585,7 +595,8 @@ function item_post(&$a) {
dbesc($datarray['deny_gid']),
intval($datarray['private']),
intval($datarray['pubmail']),
- dbesc($datarray['attach'])
+ dbesc($datarray['attach']),
+ intval($datarray['bookmark'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
diff --git a/mod/network.php b/mod/network.php
index 663814ab7..1434f5d31 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -14,7 +14,10 @@ function network_init(&$a) {
$a->page['aside'] = '';
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
- $srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '');
+ $srchurl = '/network'
+ . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '')
+ . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '')
+ . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '');
if(x($_GET,'save')) {
$r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1",
@@ -114,6 +117,7 @@ function network_content(&$a, $update = 0) {
$cid = ((x($_GET['cid'])) ? intval($_GET['cid']) : 0);
$star = ((x($_GET['star'])) ? intval($_GET['star']) : 0);
+ $bmark = ((x($_GET['bmark'])) ? intval($_GET['bmark']) : 0);
if(($a->argc > 2) && $a->argv[2] === 'new')
$nouveau = true;
@@ -174,6 +178,7 @@ function network_content(&$a, $update = 0) {
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
+ . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
@@ -195,6 +200,9 @@ function network_content(&$a, $update = 0) {
$star_sql = (($star) ? " AND `starred` = 1 " : '');
+ if($bmark)
+ $star_sql .= " AND `bookmark` = 1 ";
+
$sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $star_sql ) ";
if($group) {
diff --git a/mod/parse_url.php b/mod/parse_url.php
index b10d11c4b..79c336ddc 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -13,7 +13,7 @@ function parse_url_content(&$a) {
$text = null;
- $template = "<br /><a href=\"%s\" >%s</a>%s<br />";
+ $template = "<br /><a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
$arr = array('url' => $url, 'text' => '');
@@ -121,6 +121,10 @@ function parse_url_content(&$a) {
$title = str_replace("\n",'',$title);
- echo sprintf($template,$url,($title) ? $title : $url,$text);
+ $result = sprintf($template,$url,($title) ? $title : $url,$text);
+
+ logger('parse_url: returns: ' . $result);
+
+ echo $result;
killme();
}
diff --git a/update.php b/update.php
index 3d7b31813..f94e78d72 100644
--- a/update.php
+++ b/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1086 );
+define( 'UPDATE_VERSION' , 1087 );
/**
*
@@ -721,3 +721,8 @@ function update_1085() {
INDEX ( `term` )
) ENGINE = MYISAM ");
}
+
+function update_1086() {
+ q("ALTER TABLE `item` ADD `bookmark` tinyint(1) NOT NULL DEFAULT '0' AFTER `starred` ");
+}
+
diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css
index b97f27510..41de9b3e4 100644
--- a/view/theme/loozah/style.css
+++ b/view/theme/loozah/style.css
@@ -2424,7 +2424,8 @@ a.mail-list-link {
}
#netsearch-box {
- margin-top: 20px;
+ margin-top: 20px;
+ width: 150px;
}
#netsearch-box #search-submit {