git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
foto: inline showthumb function to format img elements
[minimedit.git]
/
article.inc.php
diff --git
a/article.inc.php
b/article.inc.php
index f56b2bedd27439e40e001e2141fbbdf2e9d5ca80..8e121d36196705ceeed56f2d17e1c1df73914308 100644
(file)
--- a/
article.inc.php
+++ b/
article.inc.php
@@
-4,6
+4,7
@@
class ArchiveArticle
public $raw, $title, $body; # file contents
public $meta = []; # head metadata properties
public $place = []; # template variables replaced in render()
public $raw, $title, $body; # file contents
public $meta = []; # head metadata properties
public $place = []; # template variables replaced in render()
+ public $api = FALSE; # requested programming interface
function __construct($path)
{
function __construct($path)
{
@@
-65,16
+66,16
@@
class ArchiveArticle
return;
}
return;
}
- function index()
+ function index(
$api = TRUE
)
{
$this->handler;
if (empty($this->handler)) {
return;
}
{
$this->handler;
if (empty($this->handler)) {
return;
}
- $
User = NULL
;
+ $
this->api = $api
;
$Page = $this;
$Page = $this;
-
$res = include "./{$this->handler}/index.php"
;
- return
$res
;
+
global $User
;
+ return
require "./{$this->handler}/index.php"
;
}
function restricted()
}
function restricted()
@@
-165,8
+166,9
@@
class ArchiveArticle
return ltrim($this->image, '/');
}
return preg_replace(
return ltrim($this->image, '/');
}
return preg_replace(
- ['{^(?:/thumb/[^/]*)?}', '/\.groot(?=\.\w+$)/'], ["thumb/$size", ''],
- $this->image
+ ['{^(?:/thumb/[^/]*)?}', '/\.groot(?=\.\w+$)/', '/(?:\.jpg)?$/'],
+ [ "thumb/$size", '', '.jpg' ],
+ $this->image, 1
);
}
);
}
@@
-221,7
+223,7
@@
class ArchiveArticle
# keep either login or logout parts depending on user level
global $User;
$userexists = $User && property_exists($User, 'login') && $User->login;
# keep either login or logout parts depending on user level
global $User;
$userexists = $User && property_exists($User, 'login') && $User->login;
- if (! ($userexists and
$User->admin("edit {$this->link}"
)) ) {
+ if (! ($userexists and
!empty($this->editable
)) ) {
# remove matching elements until first corresponding closing tag
$hideclass = $userexists ? 'logout' : 'login';
$tagmatch = '<([a-z]+) class="'.$hideclass.'"[^>]*>';
# remove matching elements until first corresponding closing tag
$hideclass = $userexists ? 'logout' : 'login';
$tagmatch = '<([a-z]+) class="'.$hideclass.'"[^>]*>';