forked from verdnatura/hedera-web
Backup
This commit is contained in:
parent
a7ed0a662a
commit
1c5612a840
|
@ -14,7 +14,7 @@ Vn.Contact = new Class
|
||||||
|
|
||||||
,refreshCaptcha: function ()
|
,refreshCaptcha: function ()
|
||||||
{
|
{
|
||||||
var url = 'rest.php?method=captcha';
|
var url = 'rest.php?method=core/captcha';
|
||||||
this.$('captcha-img').src = url +'&stamp='+ new Date ().getTime ();
|
this.$('captcha-img').src = url +'&stamp='+ new Date ().getTime ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<form
|
<form
|
||||||
id="contact-form"
|
id="contact-form"
|
||||||
method="post"
|
method="post"
|
||||||
action="rest.php?method=contact">
|
action="json.php?method=misc/contact">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><t>Name</t></label>
|
<label><t>Name</t></label>
|
||||||
<input type="text" name="name"/>
|
<input type="text" name="name"/>
|
||||||
|
|
|
@ -169,7 +169,7 @@ Vn.App = new Class
|
||||||
,'stack': error.stack
|
,'stack': error.stack
|
||||||
};
|
};
|
||||||
|
|
||||||
var request = new Vn.JsonRequest ('log');
|
var request = new Vn.JsonRequest ('core/log');
|
||||||
request.send (params);
|
request.send (params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,52 @@ class Login extends Vn\Web\JsonRequest
|
||||||
function run ()
|
function run ()
|
||||||
{
|
{
|
||||||
$this->login ();
|
$this->login ();
|
||||||
|
$this->updateCredentials ();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the user credentials in other user databases like Samba.
|
||||||
|
**/
|
||||||
|
function updateCredentials ()
|
||||||
|
{
|
||||||
|
$db = $this->getSysConn ();
|
||||||
|
|
||||||
|
$hasAccount = $db->getValue (
|
||||||
|
'SELECT COUNT(*) > 0
|
||||||
|
FROM account.user u
|
||||||
|
JOIN account.account a ON u.id = a.user_id
|
||||||
|
WHERE u.name = #',
|
||||||
|
[$_SESSION['user']]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$hasAccount)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$sshConf = $db->getRow ('SELECT host, user, password FROM ssh_config');
|
||||||
|
|
||||||
|
$ssh = ssh2_connect ($sshConf['host']);
|
||||||
|
$sshOk = $ssh && ssh2_auth_password ($ssh,
|
||||||
|
$sshConf['user'], base64_decode ($sshConf['password']));
|
||||||
|
|
||||||
|
if (!$sshOk)
|
||||||
|
{
|
||||||
|
error_log ("Can't connect to SSH server {$sshConf['host']}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $this->escape ($_SESSION['user']);
|
||||||
|
$pass = $this->escape ($_SESSION['password']);
|
||||||
|
ssh2_exec ($ssh, "samba-tool user add \"$user\" \"$pass\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escapes the double cuotes from an string.
|
||||||
|
**/
|
||||||
|
function escape ($str)
|
||||||
|
{
|
||||||
|
return str_replace ('"', '\\"', $str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -7,7 +7,7 @@ use Vn\Lib;
|
||||||
/**
|
/**
|
||||||
* Adds a document to the Document Management System.
|
* Adds a document to the Document Management System.
|
||||||
**/
|
**/
|
||||||
class DmsAdd extends Vn\Web\JsonRequest
|
class Add extends Vn\Web\JsonRequest
|
||||||
{
|
{
|
||||||
function run ()
|
function run ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ use Vn\Hedera\Image;
|
||||||
* @param integer $maxWidth The maximum width of resized image in pixels
|
* @param integer $maxWidth The maximum width of resized image in pixels
|
||||||
* @param boolean $rewrite Wether to rewrite the destination file if it exits
|
* @param boolean $rewrite Wether to rewrite the destination file if it exits
|
||||||
**/
|
**/
|
||||||
class ImageResize extends ImageMethod
|
class Resize extends ImageMethod
|
||||||
{
|
{
|
||||||
function run ()
|
function run ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ use Vn\Hedera\Image;
|
||||||
* Syncronizes the data directory with the database, this may take
|
* Syncronizes the data directory with the database, this may take
|
||||||
* some time.
|
* some time.
|
||||||
**/
|
**/
|
||||||
class ImageSync extends ImageRequest
|
class Sync extends ImageRequest
|
||||||
{
|
{
|
||||||
private $trashSubdir;
|
private $trashSubdir;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ use Vn\Hedera\Image;
|
||||||
* @param integer $width The width of the thumb
|
* @param integer $width The width of the thumb
|
||||||
* @param integer $height The height of the thumb
|
* @param integer $height The height of the thumb
|
||||||
**/
|
**/
|
||||||
class ImageThumb extends ImageRequest
|
class Thumb extends ImageRequest
|
||||||
{
|
{
|
||||||
function run ()
|
function run ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ use Vn\Hedera\Image;
|
||||||
/**
|
/**
|
||||||
* Uploads a file creating its corresponding sizes.
|
* Uploads a file creating its corresponding sizes.
|
||||||
**/
|
**/
|
||||||
class ImageUpload extends ImageRequest
|
class Upload extends ImageRequest
|
||||||
{
|
{
|
||||||
static function run ()
|
static function run ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,21 +17,19 @@ class Contact extends Vn\Web\JsonRequest
|
||||||
,'phone'
|
,'phone'
|
||||||
,'email'
|
,'email'
|
||||||
,'message'
|
,'message'
|
||||||
,'captcha'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!$this->checkParams ($_REQUEST, $params)
|
if (!$this->checkParams ($_REQUEST, $params))
|
||||||
|| !isset ($_SESSION['captcha']))
|
|
||||||
throw new Lib\UserException (s('Missing parameters'), 'missingParams');
|
throw new Lib\UserException (s('Missing parameters'), 'missingParams');
|
||||||
|
|
||||||
// Checks the antispam code
|
// Checks the antispam code
|
||||||
|
|
||||||
$lastCaptcha = $_SESSION['captcha'];
|
$lastCaptcha = $_SESSION['captcha'];
|
||||||
unset ($_SESSION['captcha']);
|
unset ($_SESSION['captcha']);
|
||||||
|
|
||||||
if ($_REQUEST['captcha'] !== $lastCaptcha)
|
if (empty ($_REQUEST['captcha']) || $_REQUEST['captcha'] !== $lastCaptcha)
|
||||||
throw new Lib\UserException (s('Wrong captcha'), 'wrongCaptcha');
|
throw new Lib\UserException (s('Wrong captcha'), 'wrongCaptcha');
|
||||||
|
|
||||||
// Sends the mail
|
// Sends the mail
|
||||||
|
|
||||||
$db = $this->getSysConn ();
|
$db = $this->getSysConn ();
|
||||||
|
|
|
@ -6,7 +6,7 @@ require_once (__DIR__.'/tpv.php');
|
||||||
/**
|
/**
|
||||||
* Gets transaction confirmations from the IMAP mailbox.
|
* Gets transaction confirmations from the IMAP mailbox.
|
||||||
**/
|
**/
|
||||||
class TpvConfirmMail extends Vn\Lib\Method
|
class ConfirmMail extends Vn\Lib\Method
|
||||||
{
|
{
|
||||||
function run ()
|
function run ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ require_once (__DIR__.'/tpv.php');
|
||||||
/**
|
/**
|
||||||
* Gets transaction confirmation from HTTP POST.
|
* Gets transaction confirmation from HTTP POST.
|
||||||
**/
|
**/
|
||||||
class TpvConfirmPost extends Vn\Web\HttpRequest
|
class ConfirmPost extends Vn\Web\HttpRequest
|
||||||
{
|
{
|
||||||
function run ()
|
function run ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ require_once (__DIR__.'/tpv.php');
|
||||||
/**
|
/**
|
||||||
* Gets transaction confirmation from SOAP service.
|
* Gets transaction confirmation from SOAP service.
|
||||||
**/
|
**/
|
||||||
class TpvConfirmSoap extends Vn\Web\HttpRequest
|
class ConfirmSoap extends Vn\Web\HttpRequest
|
||||||
{
|
{
|
||||||
function run ()
|
function run ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ use Vn\Lib;
|
||||||
/**
|
/**
|
||||||
* Starts a new TPV transaction and returns the params.
|
* Starts a new TPV transaction and returns the params.
|
||||||
**/
|
**/
|
||||||
class TpvTransaction extends Vn\Web\JsonRequest
|
class Transaction extends Vn\Web\JsonRequest
|
||||||
{
|
{
|
||||||
function run ()
|
function run ()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue