Fix: add key generator in agenda xcal admin page
This commit is contained in:
parent
87d44c845d
commit
382f1a54c3
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -51,12 +52,12 @@ if ($actionsave)
|
|||||||
if ($i >= 3)
|
if ($i >= 3)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
$mesg = "<font class=\"error\">".$langs->trans("SaveFailed")."</font>";
|
setEventMessage($langs->trans("SaveFailed"), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +96,10 @@ print "</tr>";
|
|||||||
|
|
||||||
print "<tr class=\"impair\">";
|
print "<tr class=\"impair\">";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
|
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
|
||||||
print "<td><input required=\"required\" type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_XCAL_EXPORTKEY\" value=\"". (GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha'):$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . "\" size=\"40\"></td>";
|
print '<td><input required="required" type="text" class="flat" id="MAIN_AGENDA_XCAL_EXPORTKEY" name="MAIN_AGENDA_XCAL_EXPORTKEY" value="' . (GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha'):$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . '" size="40">';
|
||||||
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
||||||
|
print '</td>';
|
||||||
print "<td> </td>";
|
print "<td> </td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
@ -147,9 +151,24 @@ $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
|||||||
$message.=$langs->trans("AgendaUrlOptions5",$user->login,$user->login);
|
$message.=$langs->trans("AgendaUrlOptions5",$user->login,$user->login);
|
||||||
print info_admin($message);
|
print info_admin($message);
|
||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
{
|
||||||
|
print "\n".'<script type="text/javascript">';
|
||||||
|
print '$(document).ready(function () {
|
||||||
|
$("#generate_token").click(function() {
|
||||||
|
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||||
|
action: \'getrandompassword\',
|
||||||
|
generic: true
|
||||||
|
},
|
||||||
|
function(token) {
|
||||||
|
$("#MAIN_AGENDA_XCAL_EXPORTKEY").val(token);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
print '</script>';
|
||||||
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -71,7 +71,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
$mesg='<div class="ok">'.$langs->trans("SetupSaved").'</div>';
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -100,37 +100,13 @@ dol_fiche_head($head, 'paypalaccount', $langs->trans("ModuleSetup"));
|
|||||||
|
|
||||||
print $langs->trans("PaypalDesc")."<br>\n";
|
print $langs->trans("PaypalDesc")."<br>\n";
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
|
||||||
{
|
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
|
||||||
print '$(document).ready(function () {
|
|
||||||
$("#apidoc").hide();
|
|
||||||
$("#apidoca").click(function() {
|
|
||||||
$("#apidoca").hide();
|
|
||||||
$("#apidoc").show();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#generate_token").click(function() {
|
|
||||||
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
|
||||||
action: \'getrandompassword\',
|
|
||||||
generic: true
|
|
||||||
},
|
|
||||||
function(token) {
|
|
||||||
$("#PAYPAL_SECURITY_TOKEN").val(token);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});';
|
|
||||||
print '</script>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test if php curl exist
|
// Test if php curl exist
|
||||||
if (! function_exists('curl_version'))
|
if (! function_exists('curl_version'))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorPhpCurlNotInstalled").'</div>';
|
setEventMessage($langs->trans("ErrorPhpCurlNotInstalled"), 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -235,7 +211,8 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>';
|
print '<tr '.$bc[$var].'><td>';
|
||||||
print $langs->trans("SecurityToken").'</td><td>';
|
print $langs->trans("SecurityToken").'</td><td>';
|
||||||
print '<input size="48" type="text" id="PAYPAL_SECURITY_TOKEN" name="PAYPAL_SECURITY_TOKEN" value="'.$conf->global->PAYPAL_SECURITY_TOKEN.'">';
|
print '<input size="48" type="text" id="PAYPAL_SECURITY_TOKEN" name="PAYPAL_SECURITY_TOKEN" value="'.$conf->global->PAYPAL_SECURITY_TOKEN.'">';
|
||||||
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -256,7 +233,8 @@ print '<br><br>';
|
|||||||
|
|
||||||
// Help doc
|
// Help doc
|
||||||
print '<u>'.$langs->trans("InformationToFindParameters","Paypal").'</u>:<br>';
|
print '<u>'.$langs->trans("InformationToFindParameters","Paypal").'</u>:<br>';
|
||||||
if ($conf->use_javascript_ajax) print '<a href="#" id="apidoca">'.$langs->trans("ClickHere").'...</a>';
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
print '<a href="#" id="apidoca">'.$langs->trans("ClickHere").'...</a>';
|
||||||
|
|
||||||
$realpaypalurl='www.paypal.com';
|
$realpaypalurl='www.paypal.com';
|
||||||
$sandboxpaypalurl='developer.paypal.com';
|
$sandboxpaypalurl='developer.paypal.com';
|
||||||
@ -374,7 +352,29 @@ if (! empty($conf->adherent->enabled))
|
|||||||
print "<br>";
|
print "<br>";
|
||||||
print info_admin($langs->trans("YouCanAddTagOnUrl"));
|
print info_admin($langs->trans("YouCanAddTagOnUrl"));
|
||||||
|
|
||||||
llxFooter();
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
{
|
||||||
|
print "\n".'<script type="text/javascript">';
|
||||||
|
print '$(document).ready(function () {
|
||||||
|
$("#apidoc").hide();
|
||||||
|
$("#apidoca").click(function() {
|
||||||
|
$("#apidoca").hide();
|
||||||
|
$("#apidoc").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#generate_token").click(function() {
|
||||||
|
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||||
|
action: \'getrandompassword\',
|
||||||
|
generic: true
|
||||||
|
},
|
||||||
|
function(token) {
|
||||||
|
$("#PAYPAL_SECURITY_TOKEN").val(token);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
print '</script>';
|
||||||
|
}
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user