diff --git a/htconfig.php b/htconfig.php
index bb0f47727a..e8aec10909 100644
--- a/htconfig.php
+++ b/htconfig.php
@@ -92,5 +92,5 @@ $a->config['system']['lockpath'] = "";
// If enabled, the MyBB fulltext engine is used
// $a->config['system']['use_fulltext_engine'] = true;
-// Let reshared messages look like wall-to-wall posts
-// $a->config['system']['diaspora_newreshare'] = true;
+// Use the new "share" element
+// $a->config['system']['new_share'] = true;
diff --git a/include/bbcode.php b/include/bbcode.php
index e09b1ed342..384fd5ebd9 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -3,6 +3,14 @@
require_once("include/oembed.php");
require_once('include/event.php');
+function bb_cleanstyle($st) {
+ return "".$st[2]."";
+}
+
+function bb_cleanclass($st) {
+ return "".$st[2]."";
+}
+
function cleancss($input) {
$cleaned = "";
@@ -213,7 +221,7 @@ function bb_ShareAttributes($match) {
$author = "";
preg_match("/author='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
- $author = $matches[1];
+ $author = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
preg_match('/author="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
@@ -385,10 +393,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = str_replace("[*]", "
", $Text);
// Check for style sheet commands
- $Text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism","$2",$Text);
+ $Text = preg_replace_callback("(\[style=(.*?)\](.*?)\[\/style\])ism","bb_cleanstyle",$Text);
// Check for CSS classes
- $Text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism","$2",$Text);
+ $Text = preg_replace_callback("(\[class=(.*?)\](.*?)\[\/class\])ism","bb_cleanclass",$Text);
// handle nested lists
$endlessloop = 0;
diff --git a/include/diaspora.php b/include/diaspora.php
index b14402b5a2..dcbe0fadaa 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -960,12 +960,12 @@ function diaspora_reshare($importer,$xml,$msg) {
$person = find_diaspora_person_by_handle($orig_author);
- if(is_array($person) && x($person,'name') && x($person,'url'))
+ /*if(is_array($person) && x($person,'name') && x($person,'url'))
$details = '[url=' . $person['url'] . ']' . $person['name'] . '[/url]';
else
$details = $orig_author;
- $prefix = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . $details . "\n";
+ $prefix = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . $details . "\n";*/
// allocate a guid on our system - we aren't fixing any collisions.
@@ -1012,7 +1012,7 @@ function diaspora_reshare($importer,$xml,$msg) {
}
}
}
-
+
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id'];
$datarray['wall'] = 0;
@@ -1024,16 +1024,8 @@ function diaspora_reshare($importer,$xml,$msg) {
$datarray['owner-name'] = $contact['name'];
$datarray['owner-link'] = $contact['url'];
$datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']);
- if (intval(get_config('system','diaspora_newreshare'))) {
- // Let reshared messages look like wall-to-wall posts
- // we have to set an additional value in the item in the future
- // to distinct the wall-to-wall-posts from reshared/repeated messages
- $datarray['author-name'] = $person['name'];
- $datarray['author-link'] = $person['url'];
- $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
- $datarray['body'] = $body;
- } else {
- $prefix = "[share author='".$person['name'].
+ if (intval(get_config('system','new_share'))) {
+ $prefix = "[share author='".str_replace("'", "'",$person['name']).
"' profile='".$person['url'].
"' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']).
"' link='".$orig_url."']";
@@ -1041,6 +1033,12 @@ function diaspora_reshare($importer,$xml,$msg) {
$datarray['author-link'] = $contact['url'];
$datarray['author-avatar'] = $contact['thumb'];
$datarray['body'] = $prefix.$body."[/share]";
+ } else {
+ // Let reshared messages look like wall-to-wall posts
+ $datarray['author-name'] = $person['name'];
+ $datarray['author-link'] = $person['url'];
+ $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
+ $datarray['body'] = $body;
}
$datarray['tag'] = $str_tags;
diff --git a/include/items.php b/include/items.php
index b5e6062b23..fa46fe1084 100755
--- a/include/items.php
+++ b/include/items.php
@@ -808,20 +808,24 @@ function get_atom_elements($feed,$item) {
if (($name != "") and ($uri != "") and ($avatar != "") and ($message != "")) {
logger('get_atom_elements: fixing sender of repeated message.');
- /*$res["owner-name"] = $res["author-name"];
- $res["owner-link"] = $res["author-link"];
- $res["owner-avatar"] = $res["author-avatar"];
+ if (intval(get_config('system','new_share'))) {
+ $prefix = "[share author='".str_replace("'", "'",$name).
+ "' profile='".$uri.
+ "' avatar='".$avatar.
+ "' link='".$orig_uri."']";
- $res["author-name"] = $name;
- $res["author-link"] = $uri;
- $res["author-avatar"] = $avatar;*/
+ $res["body"] = $prefix.html2bbcode($message)."[/share]";
+ } else {
+ $res["owner-name"] = $res["author-name"];
+ $res["owner-link"] = $res["author-link"];
+ $res["owner-avatar"] = $res["author-avatar"];
- $prefix = "[share author='".$name.
- "' profile='".$uri.
- "' avatar='".$avatar.
- "' link='".$orig_uri."']";
+ $res["author-name"] = $name;
+ $res["author-link"] = $uri;
+ $res["author-avatar"] = $avatar;
- $res["body"] = $prefix.html2bbcode($message)."[/share]";
+ $res["body"] = html2bbcode($message);
+ }
}
}
diff --git a/include/onepoll.php b/include/onepoll.php
index c493aff762..d819b7f421 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -398,14 +398,15 @@ function onepoll_run(&$argv, &$argc){
// Is it a reply?
$reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or
(substr(strtolower($datarray['title']), 0, 3) == "re-") or
- (raw_refs != ""));
+ ($raw_refs != ""));
// Remove Reply-signs in the subject
$datarray['title'] = RemoveReply($datarray['title']);
// If it seems to be a reply but a header couldn't be found take the last message with matching subject
if(!x($datarray,'parent-uri') and $reply) {
- $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) AND `uid` = %d ORDER BY `created` DESC LIMIT 1",
+ //$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) AND `uid` = %d ORDER BY `created` DESC LIMIT 1",
+ $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `title` = \"%s\" AND `uid` = %d ORDER BY `created` DESC LIMIT 1",
dbesc(protect_sprintf($datarray['title'])),
intval($importer_uid));
if(count($r))
diff --git a/mod/admin.php b/mod/admin.php
index 69b2896772..c951dd8b9c 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -241,14 +241,14 @@ function admin_page_site_post(&$a){
$maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
$maximagelength = ((x($_POST,'maximagelength')) ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH);
$jpegimagequality = ((x($_POST,'jpegimagequality')) ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY);
-
-
+
+
$register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
- $daily_registrations = ((x($_POST,'max_daily_registrations')) ? intval(trim($_POST['max_daily_registrations'])) :0);
+ $daily_registrations = ((x($_POST,'max_daily_registrations')) ? intval(trim($_POST['max_daily_registrations'])) :0);
$abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
- $register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
-
+ $register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
+
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
$block_public = ((x($_POST,'block_public')) ? True : False);
@@ -273,6 +273,13 @@ function admin_page_site_post(&$a){
$ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
$diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
$ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
+ $new_share = ((x($_POST,'new_share')) ? True : False);
+ $use_fulltext_engine = ((x($_POST,'use_fulltext_engine')) ? True : False);
+ $itemcache = ((x($_POST,'itemcache')) ? notags(trim($_POST['itemcache'])) : '');
+ $itemcache_duration = ((x($_POST,'itemcache_duration')) ? intval($_POST['itemcache_duration']) : 0);
+ $lockpath = ((x($_POST,'lockpath')) ? notags(trim($_POST['lockpath'])) : '');
+ $temppath = ((x($_POST,'temppath')) ? notags(trim($_POST['temppath'])) : '');
+ $basepath = ((x($_POST,'basepath')) ? notags(trim($_POST['basepath'])) : '');
if($ssl_policy != intval(get_config('system','ssl_policy'))) {
if($ssl_policy == SSL_POLICY_FULL) {
@@ -372,10 +379,19 @@ function admin_page_site_post(&$a){
set_config('system','ostatus_disabled', $ostatus_disabled);
set_config('system','diaspora_enabled', $diaspora_enabled);
+ set_config('system','new_share', $new_share);
+ set_config('system','use_fulltext_engine', $use_fulltext_engine);
+ set_config('system','itemcache', $itemcache);
+ set_config('system','itemcache_duration', $itemcache_duration);
+ set_config('system','lockpath', $lockpath);
+ set_config('system','temppath', $temppath);
+ set_config('system','basepath', $basepath);
+
+
info( t('Site settings updated.') . EOL);
goaway($a->get_baseurl(true) . '/admin/site' );
- return; // NOTREACHED
-
+ return; // NOTREACHED
+
}
/**
@@ -456,6 +472,7 @@ function admin_page_site(&$a) {
'$upload' => t('File upload'),
'$corporate' => t('Policies'),
'$advanced' => t('Advanced'),
+ '$performance' => t('Performance'),
'$baseurl' => $a->get_baseurl(true),
// name, label, value, help string, extra data...
@@ -465,6 +482,7 @@ function admin_page_site(&$a) {
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - change theme settings"), $theme_choices),
'$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile-theme'), t("Theme for mobile devices"), $theme_choices_mobile),
'$ssl_policy' => array('ssl_policy', t("SSL link policy"), (string) intval(get_config('system','ssl_policy')), t("Determines whether generated links should be forced to use SSL"), $ssl_choices),
+ '$new_share' => array('new_share', t("'Share' element"), get_config('system','new_share'), t("Activates the bbcode element 'share' for repeating items.")),
'$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
'$maximagelength' => array('maximagelength', t("Maximum image length"), get_config('system','max_image_length'), t("Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.")),
'$jpegimagequality' => array('jpegimagequality', t("JPEG image quality"), get_config('system','jpeg_quality'), t("Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.")),
@@ -480,7 +498,7 @@ function admin_page_site(&$a) {
'$global_directory' => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), t("URL to update the global directory. If this is not set, the global directory is completely unavailable to the application.")),
'$thread_allow' => array('thread_allow', t("Allow threaded items"), get_config('system','thread_allow'), t("Allow infinite level threading for items on this site.")),
'$newuser_private' => array('newuser_private', t("Private posts by default for new users"), get_config('system','newuser_private'), t("Set default post permissions for all new members to the default privacy group rather than public.")),
-
+
'$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
'$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),
'$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")),
@@ -496,6 +514,14 @@ function admin_page_site(&$a) {
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
+
+ '$use_fulltext_engine' => array('use_fulltext_engine', t("Use MySQL full text engine"), get_config('system','use_fulltext_engine'), t("Activates the full text engine. Speeds up search - but can only search for four and more characters.")),
+ '$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), "The item caches buffers generated bbcode and external images."),
+ '$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day).")),
+ '$lockpath' => array('lockpath', t("Path for lock file"), get_config('system','lockpath'), "The lock file is used to avoid multiple pollers at one time. Only define a folder here."),
+ '$temppath' => array('temppath', t("Temp path"), get_config('system','temppath'), "If you have a restricted system where the webserver can't access the system temp path, enter another path here."),
+ '$basepath' => array('basepath', t("Base path to installation"), get_config('system','basepath'), "If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."),
+
'$form_security_token' => get_form_security_token("admin_site"),
));
diff --git a/mod/share.php b/mod/share.php
index 761220ad7f..e307294a6d 100644
--- a/mod/share.php
+++ b/mod/share.php
@@ -18,15 +18,30 @@ function share_init(&$a) {
if(! count($r) || ($r[0]['private'] == 1))
killme();
- $o = '';
+ if (intval(get_config('system','new_share'))) {
+ if (strpos($r[0]['body'], "[/share]") !== false) {
+ $pos = strpos($r[0]['body'], "[share");
+ $o = substr($r[0]['body'], $pos);
+ } else {
+ $o = "[share author='".str_replace("'", "'",$r[0]['author-name']).
+ "' profile='".$r[0]['author-link'].
+ "' avatar='".$r[0]['author-avatar'].
+ "' link='".$r[0]['plink']."']\n";
+ if($r[0]['title'])
+ $o .= '[b]'.$r[0]['title'].'[/b]'."\n";
+ $o .= $r[0]['body'];
+ $o.= "[/share]";
+ }
+ } else {
+ $o = '';
- $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n";
- if($r[0]['title'])
- $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n";
- $o .= $r[0]['body'] . "\n" ;
-
- $o .= (($r[0]['plink']) ? '[url=' . $r[0]['plink'] . ']' . t('link') . '[/url]' . "\n" : '');
+ $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n";
+ if($r[0]['title'])
+ $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n";
+ $o .= $r[0]['body'] . "\n" ;
+ $o .= (($r[0]['plink']) ? '[url=' . $r[0]['plink'] . ']' . t('link') . '[/url]' . "\n" : '');
+ }
echo $o;
- killme();
+ killme();
}
diff --git a/view/admin_site.tpl b/view/admin_site.tpl
index 16f5b580de..4892dc3145 100644
--- a/view/admin_site.tpl
+++ b/view/admin_site.tpl
@@ -41,12 +41,14 @@