Minor - flint fixes

pull/3388/head
Julio Montoya 5 years ago
parent 2e24eba9be
commit bba8022c79
  1. 6
      main/inc/lib/plugin.class.php
  2. 1
      plugin/buycourses/src/buy_course_plugin.class.php
  3. 12
      plugin/mindmap/ajax/mindmap.ajax.php
  4. 1
      plugin/mindmap/edit-mindmap/index.php
  5. 5
      plugin/mindmap/inc/action.switch.php
  6. 5
      plugin/mindmap/inc/edit.form.php
  7. 4
      plugin/mindmap/install.php
  8. 12
      plugin/mindmap/list.php
  9. 11
      plugin/mindmap/mindmap_plugin.class.php
  10. 1
      plugin/whispeakauth/WhispeakAuthPlugin.php

@ -858,6 +858,7 @@ class Plugin
* Returns true if the plugin is installed, false otherwise.
*
* @param bool $checkEnabled Also check if enabled (instead of only installed)
*
* @return bool True if plugin is installed/enabled, false otherwise
*/
public function isEnabled($checkEnabled = false)
@ -880,8 +881,8 @@ class Plugin
[
"variable = ? AND subkey = ? AND category = 'Plugins' " => [
$this->get_name().'_tool_enable',
$this->get_name()
]
$this->get_name(),
],
]
);
if (is_array($enabled) && isset($enabled['selected_value']) && $enabled['selected_value'] == 'false') {
@ -890,6 +891,7 @@ class Plugin
return false;
}
}
return true;
}

@ -108,6 +108,7 @@ class BuyCoursesPlugin extends Plugin
* Check if plugin is enabled.
*
* @param bool $checkEnabled Check if, additionnally to being installed, the plugin is enabled
*
* @return bool
*/
public function isEnabled($checkEnabled = false)

@ -1,7 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Process the saving of the mindmap updates (when clicking the logo to get out)
* Process the saving of the mindmap updates (when clicking the logo to get out).
*/
if (isset($_GET['id'])) {
if (isset($_POST['datamap'])) {
@ -23,31 +25,29 @@ if (isset($_GET['id'])) {
}
if ($dataMap != '') {
$user = api_get_user_info();
$table = 'plugin_mindmap';
$params = [
'mindmap_data' => $dataMap
'mindmap_data' => $dataMap,
];
$whereConditions = [
'id = ?' => $idMM,
'AND (user_id = ?' => $user['id'],
'OR is_shared = 1)'
'OR is_shared = 1)',
];
$isAdmin = api_is_platform_admin();
if ($user['status'] == SESSIONADMIN || $user['status'] == PLATFORM_ADMIN || $isAdmin) {
$whereConditions = [
'id = ?' => $idMM
'id = ?' => $idMM,
];
}
$resultUp = Database::update($table, $params, $whereConditions);
echo 'OK';
} else {
echo 'KO';
}

@ -42,7 +42,6 @@
}
echo 'titleMM = "'.$titleMM.'";';
}
}
?>
</script>

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
$varString = api_get_self();
@ -18,7 +19,7 @@ switch ($action) {
'is_shared' => (empty($values['is_shared']) ? 0 : (int) $values['is_shared']),
'c_id' => $cid,
'url_id' => $urlId,
'session_id' => $sessionId
'session_id' => $sessionId,
];
$result = Database::insert($plugin->table, $params);
@ -39,7 +40,7 @@ switch ($action) {
'title' => $values['title'],
'description' => $values['description'],
'is_public' => $values['is_public'],
'is_shared' => $values['is_shared']
'is_shared' => $values['is_shared'],
];
Database::update($plugin->table, $params, ['id = ?' => $id]);
Display::addFlash(Display::return_message(get_lang('Updated')));

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Generate the form to add/edit a mindmap record
* Generate the form to add/edit a mindmap record.
*/
$form = new FormValidator(
'dictionary',
@ -10,7 +10,6 @@ $form = new FormValidator(
);
if ($action == 'add' || $action == 'edit') {
$form->addText('title', get_lang('Title'), true);
$form->addText('description', get_lang('Description'), false);
@ -20,9 +19,7 @@ if ($action == 'add' || $action == 'edit') {
$form->addElement('hidden', 'mindmap_type', 'mind');
$form->addButtonSave(get_lang('Save'));
} else {
$ht = '<p style="text-align:center;" ><img alt="'.htmlentities(get_lang('Save')).'" src="img/mindmap128.png" /></p>';
$form->addElement('static', '', '', $ht);
}

@ -1,9 +1,9 @@
<?php
/* For license terms, see /license.txt */
require_once(__DIR__.'/mindmap_plugin.class.php');
require_once __DIR__.'/mindmap_plugin.class.php';
if(!api_is_platform_admin()){
if (!api_is_platform_admin()) {
die('You must have admin permissions to install plugins');
}

@ -39,18 +39,18 @@ if (!$plugin->isEnabled(true)) {
api_not_allowed(true);
exit;
} else {
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : '';
$cid = 0;
if (!empty($_GET['cidReq'])) {
$cid = api_get_course_int_id($_GET['cidReq']);
} else {
$cid = isset($_GET['cid']) ? (int)$_GET['cid'] : 0;
$cid = isset($_GET['cid']) ? (int) $_GET['cid'] : 0;
}
if (!empty($_GET['id_session'])) {
$sessionId = (int)$_GET['id_session'];
$sessionId = (int) $_GET['id_session'];
} else {
$sessionId = isset($_GET['sid']) ? (int)$_GET['sid'] : 0;
$sessionId = isset($_GET['sid']) ? (int) $_GET['sid'] : 0;
}
if ($cid == 0) {
@ -90,7 +90,7 @@ if (!$plugin->isEnabled(true)) {
}
}
// Show create/edit form
include('inc/edit.form.php');
include 'inc/edit.form.php';
$htmlHeadXtra[] = '<script src="resources/js/jquery.dataTables.min.js?v='.$version.'" language="javascript"></script>';
@ -114,7 +114,7 @@ if (!$plugin->isEnabled(true)) {
// Process actions (add/edit/delete)
// Also exit and redirect to list if action successful
include('inc/action.switch.php');
include 'inc/action.switch.php';
}
$addButton = Display::url(

@ -3,7 +3,7 @@
/**
* Class MindmapPlugin
* This class defines the course plugin "MindMap", storing its data in the plugin_mindmap table
* This class defines the course plugin "MindMap", storing its data in the plugin_mindmap table.
*/
class MindmapPlugin extends Plugin
{
@ -22,21 +22,22 @@ class MindmapPlugin extends Plugin
'tool_enable' => 'boolean',
]
);
}
/**
* Create instance of a Mindmap plugin object
* Create instance of a Mindmap plugin object.
*
* @return MindmapPlugin|null
*/
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* Install the table structure
* Install the table structure.
*/
public function install()
{
@ -78,7 +79,7 @@ class MindmapPlugin extends Plugin
}
// Deleting course settings and course home icons
$this->uninstall_course_fields_in_all_courses();
error_log('dropping c_tool');
$p2 = api_get_path(SYS_PATH).'main/img/icons/64/mindmap.png';
if (file_exists($p2) && is_writable($p2)) {
unlink($p2);

@ -408,6 +408,7 @@ class WhispeakAuthPlugin extends Plugin implements HookPluginInterface
* Check if the WhispeakAuth plugin is installed and enabled.
*
* @param bool $checkEnabled Check if, additionnally to being installed, the plugin is enabled
*
* @return bool
*/
public function isEnabled($checkEnabled = false)

Loading…
Cancel
Save