workspaces directory for plugins
This commit is contained in:
parent
b5d4ceda09
commit
d62e19707b
@ -6,13 +6,13 @@ AddDefaultCharset UTF-8
|
||||
RewriteEngine on
|
||||
|
||||
# Base directory
|
||||
#RewriteBase /
|
||||
# RewriteBase /
|
||||
|
||||
# Deny direct access to .txt files
|
||||
RewriteRule ^bl-content/(.*)\.txt$ - [R=404,L]
|
||||
# Deny direct access to the next directories
|
||||
RewriteRule ^bl-content/(databases|workspaces|pages|tmp|)/.*$ - [R=404,L]
|
||||
|
||||
# All URL process by index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.*) index.php [PT,L]
|
||||
|
||||
</IfModule>
|
||||
</IfModule>
|
@ -214,12 +214,14 @@ class Plugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create plugin directory for databases and other files
|
||||
// Create workspace
|
||||
$workspace = $this->workspace();
|
||||
mkdir($workspace, 0755, true);
|
||||
|
||||
// Create plugin directory for the database
|
||||
mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, 0755, true);
|
||||
|
||||
// Create database
|
||||
$this->dbFields['position'] = $position;
|
||||
|
||||
// Sanitize default values to store in the file
|
||||
foreach ($this->dbFields as $key=>$value) {
|
||||
$value = Sanitize::html($value);
|
||||
@ -227,13 +229,21 @@ class Plugin {
|
||||
$this->db[$key] = $value;
|
||||
}
|
||||
|
||||
// Create the database
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
// Delete database
|
||||
$path = PATH_PLUGINS_DATABASES.$this->directoryName;
|
||||
return Filesystem::deleteRecursive($path);
|
||||
Filesystem::deleteRecursive($path);
|
||||
|
||||
// Delete workspace
|
||||
$workspace = $this->workspace();
|
||||
Filesystem::deleteRecursive($workspace);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function installed()
|
||||
@ -243,7 +253,7 @@ class Plugin {
|
||||
|
||||
public function workspace()
|
||||
{
|
||||
return PATH_PLUGINS_DATABASES.$this->directoryName.DS;
|
||||
return PATH_WORKSPACES.$this->directoryName.DS;
|
||||
}
|
||||
|
||||
public function init()
|
||||
|
@ -22,7 +22,7 @@ checkRole(array('admin'));
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
$pluginClassName = $layout['parameters'];
|
||||
if (activatePlugin($pluginClassName)===false) {
|
||||
if (!activatePlugin($pluginClassName)) {
|
||||
Log::set('Fail when try to activate the plugin.', LOG_TYPE_ERROR);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
|
||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||
define('PATH_WORKSPACES', PATH_CONTENT.'workspaces'.DS);
|
||||
|
||||
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
|
||||
define('PATH_UPLOADS_THUMBNAILS', PATH_UPLOADS.'thumbnails'.DS);
|
||||
|
@ -68,8 +68,9 @@ class Page {
|
||||
public function content($sanitize=false)
|
||||
{
|
||||
// If already set the content, return it
|
||||
if (!empty($this->getValue('content'))) {
|
||||
return $this->getValue('content');
|
||||
$content = $this->getValue('content');
|
||||
if (!empty($content)) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$contentRaw = $this->contentRaw();
|
||||
|
@ -21,28 +21,6 @@ class pluginBackup extends Plugin {
|
||||
$this->zip = extension_loaded('zip');
|
||||
}
|
||||
|
||||
// Install the plugin and create the workspace directory
|
||||
public function install($position=0)
|
||||
{
|
||||
parent::install($position);
|
||||
$workspace = $this->workspace();
|
||||
return mkdir($workspace, 0755, true);
|
||||
}
|
||||
|
||||
// Uninstall the plugin and delete the workspace directory
|
||||
public function uninstall()
|
||||
{
|
||||
parent::uninstall();
|
||||
$workspace = $this->workspace();
|
||||
return Filesystem::deleteRecursive($workspace);
|
||||
}
|
||||
|
||||
// Redefine workspace
|
||||
public function workspace()
|
||||
{
|
||||
return PATH_CONTENT.'backup'.DS;
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
if (isset($_POST['createBackup'])) {
|
||||
|
@ -59,7 +59,7 @@ class pluginRSS extends Plugin {
|
||||
$xml .= '<description>'.$site->description().'</description>';
|
||||
|
||||
// Get keys of pages
|
||||
foreach($list as $pageKey) {
|
||||
foreach ($list as $pageKey) {
|
||||
try {
|
||||
// Create the page object from the page key
|
||||
$page = new Page($pageKey);
|
||||
@ -81,13 +81,13 @@ class pluginRSS extends Plugin {
|
||||
$doc = new DOMDocument();
|
||||
$doc->formatOutput = true;
|
||||
$doc->loadXML($xml);
|
||||
$doc->save($this->workspace().'rss.xml');
|
||||
return $doc->save($this->workspace().'rss.xml');
|
||||
}
|
||||
|
||||
public function install($position=0)
|
||||
{
|
||||
parent::install($position);
|
||||
$this->createXML();
|
||||
return $this->createXML();
|
||||
}
|
||||
|
||||
public function post()
|
||||
|
@ -62,13 +62,13 @@ class pluginSitemap extends Plugin {
|
||||
$doc = new DOMDocument();
|
||||
$doc->formatOutput = true;
|
||||
$doc->loadXML($xml);
|
||||
$doc->save($this->workspace().'sitemap.xml');
|
||||
return $doc->save($this->workspace().'sitemap.xml');
|
||||
}
|
||||
|
||||
public function install($position=0)
|
||||
{
|
||||
parent::install($position);
|
||||
$this->createXML();
|
||||
return $this->createXML();
|
||||
}
|
||||
|
||||
public function post()
|
||||
|
11
install.php
11
install.php
@ -49,6 +49,7 @@ define('PATH_LANGUAGES', PATH_ROOT.'bl-languages'.DS);
|
||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
|
||||
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
||||
define('PATH_WORKSPACES', PATH_CONTENT.'workspaces'.DS);
|
||||
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
||||
define('PATH_PLUGINS_DATABASES',PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
|
||||
@ -208,8 +209,8 @@ RewriteEngine on
|
||||
# Base directory
|
||||
RewriteBase '.HTML_PATH_ROOT.'
|
||||
|
||||
# Deny direct access to .txt files
|
||||
RewriteRule ^bl-content/(.*)\.txt$ - [R=404,L]
|
||||
# Deny direct access to the next directories
|
||||
RewriteRule ^bl-content/(databases|workspaces|pages|tmp|)/.*$ - [R=404,L]
|
||||
|
||||
# All URL process by index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
@ -299,6 +300,11 @@ function install($adminPassword, $timezone)
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
}
|
||||
|
||||
if (!mkdir(PATH_WORKSPACES, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>'.PATH_WORKSPACES;
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Create files
|
||||
// ============================================================================
|
||||
@ -493,6 +499,7 @@ function install($adminPassword, $timezone)
|
||||
JSON_PRETTY_PRINT),
|
||||
LOCK_EX
|
||||
);
|
||||
mkdir(PATH_WORKSPACES.'simple-stats', DIR_PERMISSIONS, true);
|
||||
|
||||
// File plugins/tinymce/db.php
|
||||
file_put_contents(
|
||||
|
Loading…
Reference in New Issue
Block a user