Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some URLs are incorrectly calculated #2645

Closed
ddb4github opened this issue Apr 25, 2019 · 6 comments
Closed

Some URLs are incorrectly calculated #2645

ddb4github opened this issue Apr 25, 2019 · 6 comments
Labels
enhancement General tag for an enhancement resolved A fixed issue
Milestone

Comments

@ddb4github
Copy link
Contributor

The default value of "settings->'base_url'" ('http://hostname/') is not valid for report/thold/syslog as list below:

lib/reports.php:                $out = "<a href='" . html_escape(read_config_option('base_url') . '/graph.php?action=view&local_graph_id='.$item['local_graph_id']."&rra_id=0") . "'>" . $out . '</a>';
plugins/thold/thold_functions.php:      $httpurl               = read_config_option('base_url');
plugins/thold/thold_functions.php:                              'file'           => "$httpurl/graph_image.php?local_graph_id=" . $thold_data['local_graph_id'] . '&rra_id=0&view_type=tree',
plugins/thold/thold_functions.php:      $url = $httpurl . '/graph.php?local_graph_id=' . $thold_data['local_graph_id'] . '&rra_id=all';
plugins/thold/thold_functions.php:      $text = str_replace('<URL>', "<a href='" . html_escape("$httpurl/graph.php?local_graph_id=$local_graph_id") . "'>" . __('Link to Graph in Cacti', 'thold') . "</a>", $text);
plugins/syslog/syslog_process.php:                                                              $smsalert = __('Sev:', 'syslog') . $severities[$alert['severity']] . __(', Host:', 'syslog') . $a['host'] . __(', URL:', 'syslog') . read_config_option('base_url') . '/plugins/syslog/syslog.php?tab=current&id=' . $sequence;
plugins/syslog/syslog_process.php:                                              $smsalert = __('Sev:', 'syslog') . $severities[$alert['severity']] . __(', Count:', 'syslog') . sizeof($at) . __(', URL:', 'syslog') . read_config_option('base_url') . '/plugins/syslog/syslog.php?tab=current&id=' . $sequence;

It should be "http://hostname/cacti"

@cigamit
Copy link
Member

cigamit commented Apr 26, 2019

Good point.

@cigamit
Copy link
Member

cigamit commented Apr 26, 2019

I'm not sure this is a bug. The base url should be something like: http[s]://hostname/cacti already. I'm going to implement a workaround just in case.

@cigamit cigamit changed the title settings->'base_url' default value is not workable for report/thold/syslog The cacti setting 'base_url' may be incorrect for some systems. Correct it when applicable Apr 26, 2019
cigamit added a commit that referenced this issue Apr 26, 2019
The cacti setting 'base_url' may be incorrect for some systems. Correct it.
@cigamit cigamit added enhancement General tag for an enhancement resolved A fixed issue labels Apr 26, 2019
@cigamit cigamit added this to the v1.2.4 milestone Apr 26, 2019
@cigamit
Copy link
Member

cigamit commented Apr 26, 2019

This should be better now.

@ddb4github
Copy link
Contributor Author

Currently, Cacti define two default settings indicate conflict experience:

  • include/global.php:
    global -> $url_path, setting -> $config['url_path'] , Macro->URL_PATH
    Value is '/cacti/
    Assumption is 'cacti is running under a webapp '/cacti/', not directly under web server root'
  • include/global_settings.php:
    read_config_option('base_url'):
    Value is 'http://' . gethostname()
    Assumption is 'cacti page can be directly access under server name'

BTW, Issue can be workaround by simply modify and save base_url with '/cacti/' under Console-->Settings

@netniV
Copy link
Member

netniV commented Apr 26, 2019

The latter should also make use of the url_path and in not doing so would be the bug.

@netniV netniV closed this as completed in 5c24d34 Apr 29, 2019
@netniV
Copy link
Member

netniV commented Apr 29, 2019

This has now been corrected along with another bug that I spotted where $prefix was being used whilst not being primed. I also updated the description of base_url to be more clear that it should always include the url_path

@netniV netniV changed the title The cacti setting 'base_url' may be incorrect for some systems. Correct it when applicable Some URLs are incorrectly calculated Jun 2, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement General tag for an enhancement resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants