Hi.
I found another issue in 'plugins'
I have created test code for pre-create account and when i'm trying to create one I'm getting following PHP error:
Warning: Missing argument 2 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 3 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 4 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 5 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 6 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 7 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 8 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 9 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 10 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: Missing argument 11 for PluginHooks_djp::handle_precreateaccount() in /usr/local/centovacast/system/plugins/djp/hooks.php on line 25
Warning: fopen(http://newairhost.com): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /usr/local/centovacast/system/plugins/djp/hooks.php on line 48
As You can see the fopen command doesn't work, i need that to call external php code. In config url fopen is allowed.
My code:
<?php
class PluginHooks_djp extends PluginHooks {
public function install_hooks() {
PluginHooks::register('pre-create-account',array(&$this,'handle_precreateaccount'));
}
/**
* Handles the pre-create-account event
*
* @param string $username the username of the account
* @param string $password the password for the account
* @param string $email the email address for the account
* @param string $ipaddress the IP address for the account
* @param int $port the port number for the account
* @param int $maxclients the listener limit for the account
* @param int $maxbitrate the maximum bit rate for the account
* @param int $transferlimit the data transfer limit for the account
* @param int $diskquota the disk quota for the account
* @param int $usesource 1 if the autoDJ is enabled, otherwise 0
* @param int $mountlimit the mount point limit for the account
*
* @return int returns PluginHooks::OK on success, PluginHooks::ERROR on error
*/
public function handle_precreateaccount($username,$password,$email,$ipaddress,$port,$maxclients,$maxbitrate,$transferlimit,$diskquota,$usesource,$mountlimit) {
$data=array(
'username' => $username,
'password' => $password,
'email' => $email,
);
$result=$this->makeRequest('testpass',$data);
If($result)
return PluginHooks::OK;
else {
$this->set_error($result);
return PluginHooks::ERROR;
}
}
private function makeRequest( $pass, $data=array('state'=>true),$url='http://domain.com/ace/index/user/mariuszz')
{
mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');
$fp = fopen('http://domain.com', 'r');
$username = $data['username'];
if($fp){
$request = "GET /ace/index/user/mariuszz HTTP/1.0\r\nUser-Agent:Mozilla/4.0\r\n\r\n";
echo $request;
fwrite($fp, $request);
return $fp;
}
else
return FALSE;
}
}