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' );
`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',
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.
$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'])) : '');
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";
\r
// example: <strong> to [b]\r
+ rep(/<a class=\"bookmark\" href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[bookmark=$1]$2[/bookmark]");\r
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");\r
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");\r
rep(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");\r
rep(/\[\/i\]/gi,"</em>");\r
rep(/\[u\]/gi,"<u>");\r
rep(/\[\/u\]/gi,"</u>");\r
+ rep(/\[bookmark=([^\]]+)\](.*?)\[\/bookmark\]/gi,"<a class=\"bookmark\" href=\"$1\">$2</a>");\r
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");\r
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");\r
rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />");\r
}
}
+ // 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
*/
$datarray['private'] = $private;
$datarray['pubmail'] = $pubmail_enable;
$datarray['attach'] = $attachments;
+ $datarray['bookmark'] = intval($bookmark);
$datarray['thr-parent'] = $thr_parent;
/**
$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']),
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",
$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",
$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;
. ((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";
}
$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) {
$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' => '');
$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();
}
<?php
-define( 'UPDATE_VERSION' , 1086 );
+define( 'UPDATE_VERSION' , 1087 );
/**
*
INDEX ( `term` )
) ENGINE = MYISAM ");
}
+
+function update_1086() {
+ q("ALTER TABLE `item` ADD `bookmark` tinyint(1) NOT NULL DEFAULT '0' AFTER `starred` ");
+}
+
}
#netsearch-box {
- margin-top: 20px;
+ margin-top: 20px;
+ width: 150px;
}
#netsearch-box #search-submit {