bug fix: install plugins
This commit is contained in:
parent
5deb5020b7
commit
39d409ccc7
@ -59,7 +59,7 @@ class Plugin {
|
||||
$this->metadata = json_decode($metadataString, true);
|
||||
|
||||
// If the plugin is installed then get the database
|
||||
if($this->installed()) {
|
||||
if ($this->installed()) {
|
||||
$Tmp = new dbJSON($this->filenameDb);
|
||||
$this->db = $Tmp->db;
|
||||
}
|
||||
@ -124,11 +124,10 @@ class Plugin {
|
||||
// (boolean) $html, TRUE returns the value sanitized, FALSE unsanitized
|
||||
public function getValue($field, $html=true)
|
||||
{
|
||||
if( isset($this->db[$field]) ) {
|
||||
if($html) {
|
||||
if (isset($this->db[$field])) {
|
||||
if ($html) {
|
||||
return $this->db[$field];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return Sanitize::htmlDecode($this->db[$field]);
|
||||
}
|
||||
}
|
||||
@ -220,9 +219,15 @@ class Plugin {
|
||||
|
||||
// Create database
|
||||
$this->dbFields['position'] = $position;
|
||||
$this->db = $this->dbFields;
|
||||
|
||||
return true;
|
||||
// Sanitize default values to store in the file
|
||||
foreach ($this->dbFields as $key=>$value) {
|
||||
$value = Sanitize::html($value);
|
||||
settype($value, gettype($this->dbFields[$key]));
|
||||
$this->db[$key] = $value;
|
||||
}
|
||||
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
|
@ -22,7 +22,9 @@ checkRole(array('admin'));
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
$pluginClassName = $layout['parameters'];
|
||||
activatePlugin($pluginClassName);
|
||||
if (activatePlugin($pluginClassName)===false) {
|
||||
Log::set('Fail when try to activate the plugin.', LOG_TYPE_ERROR);
|
||||
}
|
||||
|
||||
if (isset($plugins['all'][$pluginClassName])) {
|
||||
$plugin = $plugins['all'][$pluginClassName];
|
||||
|
@ -23,6 +23,11 @@ class pluginAPI extends Plugin {
|
||||
$html .= $this->description();
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('URL').'</label>';
|
||||
$html .= '<p class="text-muted">'.DOMAIN.'/api/{endpoint}</p>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('API Token').'</label>';
|
||||
$html .= '<input name="token" type="text" value="'.$this->getValue('token').'">';
|
||||
|
10
things-to-do
10
things-to-do
@ -32,4 +32,12 @@ Things to do:
|
||||
-- Resize image
|
||||
|
||||
- pagex.class.php
|
||||
-- improve tags methods, compare with category
|
||||
-- improve tags methods, compare with category
|
||||
|
||||
|
||||
----
|
||||
|
||||
curl -vvv \
|
||||
-X GET \
|
||||
-G "http://localhost:8000/api/pages" \
|
||||
-d "token=80a09ba055b73f68e3c9e7c9ea12b432"
|
Loading…
Reference in New Issue
Block a user