updated GitHub links in the Admin Maintain panel

This commit is contained in:
azett 2018-12-31 13:06:25 +01:00
parent e72a859d85
commit 7e9c1666c3

View File

@ -13,30 +13,28 @@
* *
*/ */
/* utility class */ /* utility class */
class tpl_deleter extends fs_filelister { class tpl_deleter extends fs_filelister {
function __construct() { function __construct() {
//$this->smarty = $GLOBALS['_FP_SMARTY']; // $this->smarty = $GLOBALS['_FP_SMARTY'];
$this->_directory = CACHE_DIR; $this->_directory = CACHE_DIR;
parent::__construct(); parent::__construct();
} }
function _checkFile($directory, $file) { function _checkFile($directory, $file) {
if ($file != CACHE_FILE) { if ($file != CACHE_FILE) {
array_push($this->_list, $file); array_push($this->_list, $file);
fs_delete("$directory/$file"); fs_delete("$directory/$file");
} }
//trigger_error($file, E_USER_NOTICE); // trigger_error($file, E_USER_NOTICE);
return 0; return 0;
} }
} }
class s_entry_crawler extends fs_filelister { class s_entry_crawler extends fs_filelister {
var $_directory = CONTENT_DIR; var $_directory = CONTENT_DIR;
@ -47,13 +45,13 @@
function _checkFile($directory, $file) { function _checkFile($directory, $file) {
$f = "$directory/$file"; $f = "$directory/$file";
if ( is_dir($f) && ctype_digit($file)) { if (is_dir($f) && ctype_digit($file)) {
return 1; return 1;
} }
if (fnmatch('entry*'.EXT, $file)) { if (fnmatch('entry*' . EXT, $file)) {
$id=basename($file,EXT); $id = basename($file, EXT);
$arr=entry_parse($id, true); $arr = entry_parse($id, true);
echo "[POST] $id => {$arr['subject']}\n"; echo "[POST] $id => {$arr['subject']}\n";
$this->index->add($id, $arr); $this->index->add($id, $arr);
@ -62,39 +60,47 @@
} }
} }
} }
/**
* ******************
*/
class admin_maintain extends AdminPanel {
/*********************/
class admin_maintain extends AdminPanel {
var $panelname = 'maintain'; var $panelname = 'maintain';
var $actions = array('default'=>false, 'updates'=>false);
}
var $actions = array(
'default' => false,
'updates' => false
);
class admin_maintain_updates extends AdminPanelAction { }
class admin_maintain_updates extends AdminPanelAction {
// URL to fetch the latest version infos
var $web = 'http://flatpress.org/fp/VERSION'; var $web = 'http://flatpress.org/fp/VERSION';
var $fpweb = 'https://github.com/evacchi/flatpress';
var $sfweb = 'https://github.com/evacchi/flatpress/releases'; // URL to the latest final release
var $fpweb = 'https://github.com/flatpressblog/flatpress';
// URL to the latest dev release
var $sfweb = 'https://github.com/flatpressblog/flatpress/releases';
function main() { function main() {
$success = -1; $success = -1;
$ver = array( $ver = array(
'stable'=>'unknown', 'stable' => 'unknown',
'unstable'=>'unknown', 'unstable' => 'unknown'
); );
$file = utils_geturl($this->web); $file = utils_geturl($this->web);
if ($file) { if ($file) {
$ver = utils_kexplode($file['content']); $ver = utils_kexplode($file ['content']);
if (!isset($ver['stable'])) { $success = -1; } if (!isset($ver ['stable'])) {
elseif (system_ver_compare($ver['stable'], SYSTEM_VER)) { $success = -1;
} elseif (system_ver_compare($ver ['stable'], SYSTEM_VER)) {
$success = 1; $success = 1;
} else { } else {
$success = 2; $success = 2;
@ -103,29 +109,29 @@
$success = -1; $success = -1;
} }
$this->smarty->assign('updates', $ver); $this->smarty->assign('updates', $ver);
$this->smarty->assign('fpweb', $this->fpweb); $this->smarty->assign('fpweb', $this->fpweb);
$this->smarty->assign('sfweb', $this->sfweb); $this->smarty->assign('sfweb', $this->sfweb);
$this->smarty->assign('success', $success); $this->smarty->assign('success', $success);
} }
} }
class admin_maintain_default extends AdminPanelAction { class admin_maintain_default extends AdminPanelAction {
var $commands = array('do'); var $commands = array(
'do'
);
function dodo($do) { function dodo($do) {
switch ($do) { switch ($do) {
case 'rebuild': { case 'rebuild':
{
if (substr(INDEX_DIR, -1) == '/') if (substr(INDEX_DIR, -1) == '/')
$oldidx = substr(INDEX_DIR,0,-1); $oldidx = substr(INDEX_DIR, 0, -1);
$movedir = $oldidx.time(); $movedir = $oldidx . time();
header('Content-Type: text/plain'); header('Content-Type: text/plain');
echo "ENTERING LOWRES MODE\n\n"; echo "ENTERING LOWRES MODE\n\n";
@ -134,28 +140,27 @@
echo "BACKUP INDEX to $movedir\n"; echo "BACKUP INDEX to $movedir\n";
$ret = @rename($oldidx, $movedir); $ret = @rename($oldidx, $movedir);
if (!$ret) trigger_error('Cannot backup old index. STOP.', E_USER_ERROR); if (!$ret)
trigger_error('Cannot backup old index. STOP.', E_USER_ERROR);
} }
fs_mkdir(INDEX_DIR); fs_mkdir(INDEX_DIR);
new s_entry_crawler();
new s_entry_crawler;
exit("\nDONE \nPlease, select the back arrow in your browser"); exit("\nDONE \nPlease, select the back arrow in your browser");
return PANEL_NOREDIRECT; return PANEL_NOREDIRECT;
} }
case 'restorechmods': { case 'restorechmods':
$this->smarty->assign('files',fs_chmod_recursive()); {
$this->smarty->assign('files', fs_chmod_recursive());
$this->smarty->assign('success', 1); $this->smarty->assign('success', 1);
return PANEL_NOREDIRECT; return PANEL_NOREDIRECT;
} }
case 'purgetplcache': { case 'purgetplcache':
$tpldel = new tpl_deleter; {
$tpldel = new tpl_deleter();
unset($tpldel); unset($tpldel);
$this->smarty->cache_dir = CACHE_DIR.'cache/'; $this->smarty->cache_dir = CACHE_DIR . 'cache/';
$this->smarty->caching = 0; $this->smarty->caching = 0;
$this->smarty->clear_all_cache(); $this->smarty->clear_all_cache();
$this->smarty->clear_compiled_tpl(); $this->smarty->clear_compiled_tpl();
@ -168,7 +173,8 @@
return PANEL_NOREDIRECT; return PANEL_NOREDIRECT;
} }
case 'phpinfo': { case 'phpinfo':
{
ob_start(); ob_start();
phpinfo(); phpinfo();
$info = ob_get_contents(); $info = ob_get_contents();
@ -179,16 +185,11 @@
return PANEL_NOREDIRECT; return PANEL_NOREDIRECT;
} }
} }
function main() { function main() {
} }
} }
?> ?>