Skip to content

Commit

Permalink
Fix issue #1:
Browse files Browse the repository at this point in the history
* wrong call to API api_plugin_db_add_column
* problem in save function (the parameters intropage_opts was not saved).
* a display bug in intropage.php when you have an separated tab.
  • Loading branch information
earendilfr committed Mar 20, 2017
1 parent e2d014e commit a5c0313
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions INFO
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[info]
name = intropage
version = 0.9
version = 0.9.1
longname = Intropage
author = Petr Macek
email = [email protected]
homepage = http://www.cacti.net
compat = 1.0.0
capabilities = online_view:1, online_mgmt:1, offline_view:0, offline_mgmt:0, remote_collect:0
capabilities = online_view:1, online_mgmt:1, offline_view:0, offline_mgmt:0, remote_collect:0
8 changes: 8 additions & 0 deletions include/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,12 @@ function intropage_console_after() {
}
}

function intropage_user_admin_setup_sql_save($save) {
global $settings_user;

$save['intropage_opts'] = form_input_validate(get_nfilter_request_var('intropage_opts'), 'intropage_opts', '^[01]$', true, 3);

return $save;
}

?>
13 changes: 5 additions & 8 deletions intropage.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<?php

chdir('../../');
include("./include/auth.php");
include("./plugins/intropage/display.php");
include_once("./include/auth.php");
include_once("./plugins/intropage/display.php");

set_default_action();


$lopts = db_fetch_cell('SELECT intropage_opts FROM user_auth WHERE id=' . $_SESSION['sess_user_id']);
if ($lopts == 1)
general_header();

display_information();

if ($lopts == 1)
top_header();

display_informations();

intropage_console_after();

if ($lopts == 1)
bottom_footer();

?>
?>
5 changes: 4 additions & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function plugin_intropage_install() {
api_plugin_register_hook('intropage', 'top_graph_header_tabs', 'intropage_show_tab', 'include/tab.php');

api_plugin_register_hook('intropage', 'console_after', 'intropage_console_after', 'include/settings.php');

api_plugin_register_hook('intropage', 'user_admin_setup_sql_save', 'intropage_user_admin_setup_sql_save', 'include/settings.php');

api_plugin_register_realm('intropage', 'intropage.php', 'Plugin Intropage - view', 1);

intropage_setup_database();
Expand Down Expand Up @@ -54,7 +57,7 @@ function intropage_check_upgrade() {

function intropage_setup_database() {
global $config, $intropage_settings;
api_plugin_db_add_column ('user_auth',array('name' => 'intropage_opts', 'type' => 'tinyint(1)', 'NULL' => false, 'default' => '0'));
api_plugin_db_add_column ('intropage', 'user_auth',array('name' => 'intropage_opts', 'type' => 'tinyint(1)', 'NULL' => false, 'default' => '0'));

include_once($config['base_path'] . '/plugins/intropage/include/variables.php');
$sql_insert = '';
Expand Down

0 comments on commit a5c0313

Please sign in to comment.