$result = cpg_db_query($sql); // Shift the plugins up $sql = 'UPDATE ' . $CONFIG['TABLE_PLUGINS'] . ' SET priority=priority-1 WHERE priority>' . $priority . ';'; $result = cpg_db_query($sql); if ($CONFIG['log_mode']) { log_write("Plugin '" . $name . "' uninstalled", CPG_GLOBAL_LOG); } } } break; case 'install': if (!checkFormToken()) { cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__); } if ($CONFIG['enable_plugins']) { $installed = CPGPluginAPI::install($p); } else { cpgRedirectPage('pluginmgr.php', $lang_pluginmgr_php['pmgr'], $lang_pluginmgr_php['plugin_disabled_note']); } break; case 'delete': if (!checkFormToken()) { cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__); } $path = $p; if (is_bool(strpos('/', $path))) { cpg_folder_file_delete('./plugins/' . $path); if ($CONFIG['log_mode']) { log_write("Plugin '" . $path . "' deleted", CPG_GLOBAL_LOG); } }
/** * Plugin manager events * * Executes manager events */ $op = @$_GET['op']; switch ($op) { case 'uninstall': $plugin_id = $_GET['p']; if (!is_numeric($_GET['p'])) { $plugin_id = CPGPluginAPI::installed($plugin_id); } $uninstalled = CPGPluginAPI::uninstall($plugin_id); break; case 'install': $installed = CPGPluginAPI::install($_GET['p']); break; case 'delete': $path = $_GET['p']; if (is_bool(strpos('/', $path))) { deldir('./plugins/' . $path); } break; case 'moveu': $thisplugin = @$CPG_PLUGINS[$_GET['p']]; if (isset($thisplugin) && ($priority = $thisplugin->priority) > 0) { // Move the plugin above down $sql = 'update ' . $CONFIG['TABLE_PLUGINS'] . ' set priority=' . $priority . ' where priority=' . ($priority - 1) . ';'; cpg_db_query($sql); // Move this plugin up $sql = 'update ' . $CONFIG['TABLE_PLUGINS'] . ' ' . 'set priority=' . ($priority - 1) . ' where plugin_id=' . $thisplugin->plugin_id . ';';