| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <<<<<<< HEAD
- <?php
- /**
- * Vesta Control Panel Password Driver
- *
- * @version 1.0
- * @author Serghey Rodin <[email protected]>
- */
- class rcube_vesta_password
- {
- function save($curpass, $passwd)
- {
- $rcmail = rcmail::get_instance();
- $vesta_host = $rcmail->config->get('password_vesta_host');
- if (empty($vesta_host))
- {
- $vesta_host = 'localhost';
- }
- $vesta_port = $rcmail->config->get('password_vesta_port');
- if (empty($vesta_port))
- {
- $vesta_port = '8083';
- }
- $request = 'email='.$_SESSION['username'].'&';
- $request .= 'password='.$curpass.'&';
- $request .= 'new='.$passwd.'&';
- $context = stream_context_create(array(
- 'http' => array(
- 'method' => 'POST',
- 'header' => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL,
- 'content' => $request,
- ),
- ));
- $result = file_get_contents(
- $file = "https://".$vesta_host.":".$vesta_port."/reset/mail/?",
- $use_include_path = false,
- $context);
- if ($result == 'ok'){
- return PASSWORD_SUCCESS;
- }
- else {
- return PASSWORD_ERROR;
- }
- }
- }
- =======
- <?php
- /**
- * Vesta Control Panel Password Driver
- *
- * @version 1.0
- * @author Serghey Rodin <[email protected]>
- */
- class rcube_vesta_password
- {
- function save($curpass, $passwd)
- {
- $rcmail = rcmail::get_instance();
- $vesta_host = $rcmail->config->get('password_vesta_host');
- if (empty($vesta_host))
- {
- $vesta_host = 'localhost';
- }
- $vesta_port = $rcmail->config->get('password_vesta_port');
- if (empty($vesta_port))
- {
- $vesta_port = '8083';
- }
- $postvars = array(
- 'email' => $_SESSION['username'],
- 'password' => $curpass,
- 'new' => $passwd
- );
- $postdata = http_build_query($postvars);
- $send = 'POST /reset/mail/ HTTP/1.1' . PHP_EOL;
- $send .= 'Host: ' . $vesta_host . PHP_EOL;
- $send .= 'User-Agent: PHP Script' . PHP_EOL;
- $send .= 'Content-length: ' . strlen($postdata) . PHP_EOL;
- $send .= 'Content-type: application/x-www-form-urlencoded' . PHP_EOL;
- $send .= 'Connection: close' . PHP_EOL;
- $send .= PHP_EOL;
- $send .= $postdata . PHP_EOL . PHP_EOL;
- $fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
- fputs($fp, $send);
- $result = fread($fp, 2048);
- fclose($fp);
- if(strpos($result, 'ok') && !strpos($html, 'error'))
- {
- return PASSWORD_SUCCESS;
- }
- else {
- return PASSWORD_ERROR;
- }
- }
- }
- >>>>>>> 994c40901078e48fe939536f7b366e29c2e44a1d
|