typos in bbcode, add service class restrictions to jot uploads
This commit is contained in:
parent
89ad19ce01
commit
b044cd922d
5 changed files with 40 additions and 11 deletions
|
@ -113,7 +113,7 @@ function bb2diaspora($Text,$preserve_nl = false) {
|
||||||
// to define the closing tag for the list elements. So nested lists
|
// to define the closing tag for the list elements. So nested lists
|
||||||
// are going to be flattened out in Diaspora for now
|
// are going to be flattened out in Diaspora for now
|
||||||
$endlessloop = 0;
|
$endlessloop = 0;
|
||||||
while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)
|
while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) &&
|
||||||
(strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) &&
|
(strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) &&
|
||||||
(strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) {
|
(strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) {
|
||||||
$Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text);
|
$Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text);
|
||||||
|
|
|
@ -162,7 +162,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
|
||||||
|
|
||||||
// handle nested lists
|
// handle nested lists
|
||||||
$endlessloop = 0;
|
$endlessloop = 0;
|
||||||
while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)
|
while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) &&
|
||||||
(strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) &&
|
(strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) &&
|
||||||
(strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) {
|
(strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) {
|
||||||
$Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
|
$Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
|
||||||
|
|
|
@ -380,20 +380,23 @@ function service_class_fetch($uid,$property) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_link() {
|
function upgrade_link($bbcode = false) {
|
||||||
$l = get_config('service_class','upgrade_link');
|
$l = get_config('service_class','upgrade_link');
|
||||||
$t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l);
|
if(! $l)
|
||||||
if($l)
|
|
||||||
return $t;
|
|
||||||
return '';
|
return '';
|
||||||
|
if($bbcode)
|
||||||
|
$t = sprintf('[url=%s]' . t('Click here to upgrade.') . '[/url]', $l);
|
||||||
|
else
|
||||||
|
$t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l);
|
||||||
|
return $t;
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_message() {
|
function upgrade_message($bbcode = false) {
|
||||||
$x = upgrade_link();
|
$x = upgrade_link($bbcode);
|
||||||
return t('This action exceeds the limits set by your subscription plan.') . (($x) ? ' ' . $x : '') ;
|
return t('This action exceeds the limits set by your subscription plan.') . (($x) ? ' ' . $x : '') ;
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_bool_message() {
|
function upgrade_bool_message($bbcode = false) {
|
||||||
$x = upgrade_link();
|
$x = upgrade_link($bbcode);
|
||||||
return t('This action is not available under your subscription plan.') . (($x) ? ' ' . $x : '') ;
|
return t('This action is not available under your subscription plan.') . (($x) ? ' ' . $x : '') ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,19 @@ function wall_attach_post(&$a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$r = q("select sum(octet_length(data)) as total from attach where uid = %d ",
|
||||||
|
intval($page_owner_uid)
|
||||||
|
);
|
||||||
|
|
||||||
|
$limit = service_class_fetch($page_owner_uid,'attach_upload_limit');
|
||||||
|
|
||||||
|
if(($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
|
||||||
|
echo upgrade_message(true) . EOL ;
|
||||||
|
@unlink($src);
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$filedata = @file_get_contents($src);
|
$filedata = @file_get_contents($src);
|
||||||
$mimetype = z_mime_content_type($filename);
|
$mimetype = z_mime_content_type($filename);
|
||||||
$hash = random_string();
|
$hash = random_string();
|
||||||
|
|
|
@ -79,6 +79,19 @@ function wall_upload_post(&$a) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ",
|
||||||
|
intval($page_owner_uid)
|
||||||
|
);
|
||||||
|
|
||||||
|
$limit = service_class_fetch($page_owner_uid,'photo_upload_limit');
|
||||||
|
|
||||||
|
if(($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
|
||||||
|
echo upgrade_message(true) . EOL ;
|
||||||
|
@unlink($src);
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
$ph = new Photo($imagedata, $filetype);
|
$ph = new Photo($imagedata, $filetype);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue