PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/webservices/admin/webservices.php

https://bitbucket.org/speedealing/speedealing
PHP | 160 lines | 101 code | 30 blank | 29 comment | 13 complexity | 68d3e6281e9d9f4d2f4a7e06d4e35474 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.org>
  4. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/webservices/admin/webservices.php
  21. * \ingroup webservices
  22. * \brief Page to setup webservices module
  23. */
  24. require '../../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. $langs->load("admin");
  27. if (! $user->admin) accessforbidden();
  28. $actionsave=GETPOST("save");
  29. $mesg='';
  30. // Sauvegardes parametres
  31. if ($actionsave)
  32. {
  33. $i=0;
  34. $db->begin();
  35. $i+=dolibarr_set_const($db,'WEBSERVICES_KEY',trim(GETPOST("WEBSERVICES_KEY")),'chaine',0,'',$conf->entity);
  36. if ($i >= 1)
  37. {
  38. $db->commit();
  39. $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
  40. }
  41. else
  42. {
  43. $db->rollback();
  44. $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
  45. }
  46. }
  47. /*
  48. * View
  49. */
  50. llxHeader();
  51. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  52. print_fiche_titre($langs->trans("WebServicesSetup"),$linkback,'setup');
  53. print $langs->trans("WebServicesDesc")."<br>\n";
  54. print "<br>\n";
  55. print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
  56. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  57. print '<table class="noborder" width="100%">';
  58. print '<tr class="liste_titre">';
  59. print "<td>".$langs->trans("Parameter")."</td>";
  60. print "<td>".$langs->trans("Value")."</td>";
  61. //print "<td>".$langs->trans("Examples")."</td>";
  62. print "<td>&nbsp;</td>";
  63. print "</tr>";
  64. print '<tr class="impair">';
  65. print '<td class="fieldrequired">'.$langs->trans("KeyForWebServicesAccess").'</td>';
  66. print '<td><input type="text" class="flat" name="WEBSERVICES_KEY" value="'. (GETPOST('WEBSERVICES_KEY')?GETPOST('WEBSERVICES_KEY'):(! empty($conf->global->WEBSERVICES_KEY)?$conf->global->WEBSERVICES_KEY:'')) . '" size="20"></td>';
  67. print '<td>&nbsp;</td>';
  68. print '</tr>';
  69. print '</table>';
  70. print '<br><center>';
  71. print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
  72. print '</center>';
  73. print '</form>';
  74. dol_htmloutput_mesg($mesg);
  75. print '<br><br>';
  76. // WSDL
  77. print '<u>'.$langs->trans("WSDLCanBeDownloadedHere").':</u><br>';
  78. $url=DOL_MAIN_URL_ROOT.'/webservices/server_other.php?wsdl';
  79. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  80. if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
  81. {
  82. $url=DOL_MAIN_URL_ROOT.'/webservices/server_productorservice.php?wsdl';
  83. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  84. }
  85. if (! empty($conf->societe->enabled))
  86. {
  87. $url=DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php?wsdl';
  88. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  89. }
  90. if (! empty($conf->facture->enabled))
  91. {
  92. $url=DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php?wsdl';
  93. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  94. }
  95. if (! empty($conf->fournisseur->enabled))
  96. {
  97. $url=DOL_MAIN_URL_ROOT.'/webservices/server_supplier_invoice.php?wsdl';
  98. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  99. }
  100. print '<br>';
  101. // Endpoint
  102. print '<u>'.$langs->trans("EndPointIs").':</u><br>';
  103. $url=DOL_MAIN_URL_ROOT.'/webservices/server_other.php';
  104. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  105. if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
  106. {
  107. $url=DOL_MAIN_URL_ROOT.'/webservices/server_productorservice.php';
  108. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  109. }
  110. if (! empty($conf->societe->enabled))
  111. {
  112. $url=DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php';
  113. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  114. }
  115. if (! empty($conf->facture->enabled))
  116. {
  117. $url=DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php';
  118. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  119. }
  120. if (! empty($conf->fournisseur->enabled))
  121. {
  122. $url=DOL_MAIN_URL_ROOT.'/webservices/server_supplier_invoice.php';
  123. print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
  124. }
  125. print '<br>';
  126. print '<br>';
  127. print $langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php');
  128. $db->close();
  129. llxFooter();
  130. ?>