PDA

View Full Version : Plugin writing problems and Questions



fusionictnl
07-11-2004, 09:26 AM
I've created a plugin for Awstats in DA.

It's name shows up as "Hello World" in the CP, but under Plugin Manager it says "AwStats", a bug ???

http://www.directadmin.com/forum/showthread.php?s=&threadid=3901

I have 2 questions about creating a plugin:

1:
When I make a submit form and do a submit. The url shows up correctly CMD_PLUGIN...... ?var=variable, but I can't get the values with PHP as $_POST["var"] or $_ENV["var"] or $_GET["var"], how can I get these posted vars ???

2:
Can a plugin communicate with the CP ? Without letting the user know the plugin what it's usr/pass is ? (Plugins are started as a seperate process?)
Or does some enviroment variable contain the password?? I can get the username but not the password!

I would really like these questions answered so I can expand my plugin to contain extra features for AwStats with DA.

Thx!!

fusionictnl
07-11-2004, 11:28 AM
I got the answer on my first question :)

Variables can be find in: $_SERVER["QUERY_STRING"];

But the second question :confused:

l0rdphi1
07-11-2004, 11:34 AM
Hello,

Originally posted by fusionictnl
2:
Can a plugin communicate with the CP ? Without letting the user know the plugin what it's usr/pass is ? (Plugins are started as a seperate process?)
Or does some enviroment variable contain the password?? I can get the username but not the password! For Installatron, I use this class (http://www.directadmin.com/forum/showthread.php?s=&threadid=258) to communicate with the DA API. You'll automatically be "logged-in" as the current user.

Phi1.

l0rdphi1
07-11-2004, 11:35 AM
I.e.:
$Socket = new HTTPSocket;
$Socket->connect('127.0.0.1',2222);
$Socket->set_login($_SERVER['USER']);

$Socket->query('/CMD_API_SHOW_DOMAINS');
$query_result = $Socket->fetch_parsed_body();

print_r($query_result);

fusionictnl
07-11-2004, 12:06 PM
Thanks!

Now only the first one :) How can I change the name as it shows up in the Control Panel ;)

fusionictnl
07-11-2004, 12:47 PM
In the hooks dir are some txt files. In here you can specify the name ;)

thuskey
07-11-2004, 12:48 PM
Your answer appears to be in the hooks directory. Modify the links before creating your tar.gz file and update your plugin on your hosting server.


oops, posted and then saw you found your own answer.