bug fix: install plugins
This commit is contained in:
parent
5deb5020b7
commit
39d409ccc7
|
@ -127,8 +127,7 @@ class Plugin {
|
|||
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').'">';
|
||||
|
|
|
@ -33,3 +33,11 @@ Things to do:
|
|||
|
||||
- pagex.class.php
|
||||
-- improve tags methods, compare with category
|
||||
|
||||
|
||||
----
|
||||
|
||||
curl -vvv \
|
||||
-X GET \
|
||||
-G "http://localhost:8000/api/pages" \
|
||||
-d "token=80a09ba055b73f68e3c9e7c9ea12b432"
|
Loading…
Reference in New Issue