Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


$config['url_path'] is not evaluated in plugin scripts

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin General
Author Message
format_c



Joined: 17 Aug 2007
Posts: 11

PostPosted: Mon Mar 10, 2008 3:46 pm    Post subject: $config['url_path'] is not evaluated in plugin scripts Reply with quote

Hi,

Cacti seems to work well. But opening a plugin (e.g. monitor) styles look wrong. Seems the $config['url_path'] variable isnt evaluated that compensates the plugin path in the url. poller.php for example includes global.php which includes config.php where the variable is set. But the second include seems not to be executed.

Do I have to set something special in php5?

Cheers Alex
Back to top
pepj
Cacti User


Joined: 29 Sep 2005
Posts: 288
Location: switzerland

PostPosted: Tue Mar 11, 2008 10:44 am    Post subject: Re: $config['url_path'] is not evaluated in plugin scripts Reply with quote

format_c wrote:
Hi,
$config['url_path'] variable isnt evaluated


look at www.cactiusers.net
URL=http://cactiusers.org/forums/viewtopic.php?p=5181#5181
Back to top
format_c



Joined: 17 Aug 2007
Posts: 11

PostPosted: Tue Mar 11, 2008 4:02 pm    Post subject: Reply with quote

Mhh in the posts the problem seems not to be solved; just described?

Cheers Alex
Back to top
pepj
Cacti User


Joined: 29 Sep 2005
Posts: 288
Location: switzerland

PostPosted: Wed Mar 12, 2008 3:18 am    Post subject: Reply with quote

format_c wrote:
Mhh in the posts the problem seems not to be solved; just described?

I had not really good explain how to solve it because I wanted Gigamit/Jimmy give a answer (and perhaps a better solution).

How to solve --->
in "plugings.php"
relpace:

Code:

if (isset($_SERVER['DOCUMENT_ROOT']) && isset($_SERVER['REMOTE_ADDR'])) {
   $config['url_path'] = substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT']), strlen(__FILE__) - strlen($_SERVER['DOCUMENT_ROOT']) - strlen('include/plugins.php'));
   db_execute("REPLACE INTO settings (name, value) VALUES ('url_path', '" . $config['url_path'] . "')");
} else {
   $config['url_path'] = db_fetch_cell("SELECT value FROM settings WHERE name = 'url_path'");
}

define('URL_PATH', $config['url_path']);


with

Code:

if (isset($_SERVER['DOCUMENT_ROOT']) && isset($_SERVER['REMOTE_ADDR'])) {
   $config['url_path'] = substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT']), strlen(__FILE__) - strlen($_SERVER['DOCUMENT_ROOT']) - strlen('include/plugins.php'));
  $search= array('\\');
  $replace='/';
  $config['url_path']= str_replace($search,$replace,$config['url_path']);
   db_execute("REPLACE INTO settings (name, value) VALUES ('url_path', '" . $config['url_path'] . "')");
} else {
   $config['url_path'] = db_fetch_cell("SELECT value FROM settings WHERE name = 'url_path'");
}

define('URL_PATH', $config['url_path']);

[/b]
Back to top
format_c



Joined: 17 Aug 2007
Posts: 11

PostPosted: Fri Mar 14, 2008 6:15 am    Post subject: Reply with quote

Mhh I do not have such a sniplet in my plugins.php.
I am Using cacti-plugin-arch 0.8.7b.

Cacti has also version 0.8.7b.

I do not understand what I am doing wrong.

cheers Alex
Back to top
pepj
Cacti User


Joined: 29 Sep 2005
Posts: 288
Location: switzerland

PostPosted: Sat Mar 15, 2008 4:07 pm    Post subject: Reply with quote

format_c wrote:
Mhh I do not have such a sniplet in my plugins.php.
I am Using cacti-plugin-arch 0.8.7b.
Cacti has also version 0.8.7b.
I do not understand what I am doing wrong.


file "plugins.php" delivered in PA 2.0
http://cactiusers.org/downloads/patches/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin General All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group