define ( 'FRIENDICA_CODENAME', 'Lily of the valley');
define ( 'FRIENDICA_VERSION', '3.4.0' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1184 );
+define ( 'DB_UPDATE_VERSION', 1185 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
-- ------------------------------------------
-- Friendica 3.4.0 (Lily of the valley)
--- DB_UPDATE_VERSION 1183
+-- DB_UPDATE_VERSION 1185
-- ------------------------------------------
CREATE TABLE IF NOT EXISTS `guid` (
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
`guid` varchar(255) NOT NULL DEFAULT '',
- INDEX `guid` (`guid`)
+ `plink` varchar(255) NOT NULL DEFAULT '',
+ `uri` varchar(255) NOT NULL DEFAULT '',
+ `network` varchar(32) NOT NULL DEFAULT '',
+ INDEX `guid` (`guid`),
+ INDEX `plink` (`plink`),
+ INDEX `uri` (`uri`)
) DEFAULT CHARSET=utf8;
--
`msg` mediumtext NOT NULL,
`uid` int(11) NOT NULL DEFAULT 0,
`link` varchar(255) NOT NULL DEFAULT '',
+ `iid` int(11) NOT NULL DEFAULT 0,
`parent` int(11) NOT NULL DEFAULT 0,
`seen` tinyint(1) NOT NULL DEFAULT 0,
`verb` varchar(255) NOT NULL DEFAULT '',
// Use the old style "share"
// $a->config['system']['old_share'] = false;
+
+//Deny public access to the local directory
+//$a->config['system']['block_local_dir'] = false;
+
$Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
$Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);
- $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text);
+ $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text);
$Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text);
$Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text);
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
}
- // Unhide all [noparse] contained bbtags unspacefying them
+ // Unhide all [noparse] contained bbtags unspacefying them
// and triming the [noparse] tag.
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim',$Text);
// fix any escaped ampersands that may have been converted into links
$Text = preg_replace("/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
- $Text = preg_replace("/\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|cid)(.*?)\>/ism",'<$1$2="">',$Text);
+// $Text = preg_replace("/\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|cid)(.*?)\>/ism",'<$1$2="">',$Text);
if($saved_image)
$Text = bb_replace_images($Text, $saved_image);
"fields" => array(
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+ "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+ "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+ "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
),
"indexes" => array(
"PRIMARY" => array("id"),
"guid" => array("guid"),
+ "plink" => array("plink"),
+ "uri" => array("uri"),
)
);
$database["hook"] = array(
return xmlify($o);
}
+function add_guid($item) {
+ $r = q("SELECT `guid` FROM `guid` WHERE `guid` = '%s' LIMIT 1", dbesc($item["guid"]));
+ if ($r)
+ return;
+ q("INSERT INTO `guid` (`guid`,`plink`,`uri`,`network`) VALUES ('%s','%s','%s','%s')",
+ dbesc($item["guid"]), dbesc($item["plink"]),
+ dbesc($item["uri"]), dbesc($item["network"]));
+}
function item_store($arr,$force_parent = false, $notify = false, $dontcache = false) {
}
// If there is no guid then take the same guid that was taken before for the same uri
- if ((trim($arr['guid']) == "") AND (trim($arr['uri']) != "")) {
+ if ((trim($arr['guid']) == "") AND (trim($arr['uri']) != "") AND (trim($arr['network']) != "")) {
logger('item_store: checking for an existing guid for uri '.$arr['uri'], LOGGER_DEBUG);
- $r = q("SELECT `guid` FROM `item` WHERE `uri` = '%s' AND `guid` != '' LIMIT 1",
- dbesc(trim($arr['uri']))
- );
+ $r = q("SELECT `guid` FROM `guid` WHERE `uri` = '%s' AND `network` = '%s' LIMIT 1",
+ dbesc(trim($arr['uri'])), dbesc(trim($arr['network'])));
if(count($r)) {
$arr['guid'] = $r[0]["guid"];
}
// If there is no guid then take the same guid that was taken before for the same plink
- if ((trim($arr['guid']) == "") AND (trim($arr['plink']) != "")) {
+ if ((trim($arr['guid']) == "") AND (trim($arr['plink']) != "") AND (trim($arr['network']) != "")) {
logger('item_store: checking for an existing guid for plink '.$arr['plink'], LOGGER_DEBUG);
- $r = q("SELECT `guid` FROM `item` WHERE `plink` = '%s' AND `guid` != '' LIMIT 1",
- dbesc(trim($arr['plink']))
- );
+ $r = q("SELECT `guid` FROM `guid` WHERE `plink` = '%s' AND `network` = '%s' LIMIT 1",
+ dbesc(trim($arr['plink'])), dbesc(trim($arr['network'])));
if(count($r)) {
$arr['guid'] = $r[0]["guid"];
);
if(count($r)) {
+
+ // Store the guid and other relevant data
+ add_guid($arr);
+
$current_post = $r[0]['id'];
logger('item_store: created item ' . $current_post);
// mask hashtags inside of url, bookmarks and attachments to avoid urls in urls
$item["body"] = preg_replace_callback("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
function ($match){
- return("[url=".$match[1]."]".str_replace("#", "#", $match[2])."[/url]");
+ return("[url=".str_replace("#", "#", $match[1])."]".str_replace("#", "#", $match[2])."[/url]");
},$item["body"]);
$item["body"] = preg_replace_callback("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism",
function ($match){
- return("[bookmark=".$match[1]."]".str_replace("#", "#", $match[2])."[/bookmark]");
+ return("[bookmark=".str_replace("#", "#", $match[1])."]".str_replace("#", "#", $match[2])."[/bookmark]");
},$item["body"]);
$item["body"] = preg_replace_callback("/\[attachment (.*)\](.*?)\[\/attachment\]/ism",
$item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
"#$2", $item["body"]);
+
foreach($tags as $tag) {
if(strpos($tag,'#') !== 0)
continue;
/* modified posted_dates() {below} to arrange the list in years */
function list_post_dates($uid, $wall) {
$dnow = datetime_convert('',date_default_timezone_get(),'now','Y-m-d');
-
- $dthen = first_post_date($uid, $wall);
+
+ $dthen = first_post_date($uid, $wall);
if(! $dthen)
return array();
-
+
// Set the start and end date to the beginning of the month
$dnow = substr($dnow,0,8).'01';
$dthen = substr($dthen,0,8).'01';
-
+
$ret = array();
-
+
// Starting with the current month, get the first and last days of every
// month down to and including the month of the first post
while(substr($dnow, 0, 7) >= substr($dthen, 0, 7)) {
/* if($wall && intval(get_pconfig($uid,'system','no_wall_archive_widget')))
return $o;*/
-
+
$visible_years = get_pconfig($uid,'system','archive_visible_years');
if(! $visible_years)
- $visible_years = 5;
-
+ $visible_years = 5;
+
$ret = list_post_dates($uid,$wall);
-
+
if(! count($ret))
return $o;
$cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
$cutoff = ((array_key_exists($cutoff_year,$ret))? true : false);
-
+
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),array(
'$title' => t('Archives'),
'$size' => $visible_years,
} else {
// add <a> for html2bbcode conversion
$ret .= "<a href='$embedurl' rel='oembed'>$embedurl</a>";
- $ret.="<br style='clear:left'></span>";
+ $ret .= "<br style='clear:left'>";
}
+ $ret.="</span>";
return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
}
require_once("mod/proxy.php");
- if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) ||
+ (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
// NOTREACHED
}
+ // Store the guid and other relevant data
+ add_guid($datarray);
+
$post_id = $r[0]['id'];
logger('mod_item: saved item ' . $post_id);
$system_mode = false;
- if(intval(get_config('system','block_public')))
+ if(intval(get_config('system','block_public')) || (get_config('system','block_local_dir')))
http_status_exit(401);
<?php
-define( 'UPDATE_VERSION' , 1184 );
+define( 'UPDATE_VERSION' , 1185 );
/**
*