PageRenderTime 42ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/adherent/admin/public.php

https://bitbucket.org/speedealing/speedealing
PHP | 204 lines | 112 code | 41 blank | 51 comment | 10 complexity | 2ee9cdd78a2cf0a88944713cc24dfbb6 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
  5. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/adherents/admin/public.php
  22. * \ingroup member
  23. * \brief File of main public page for member module
  24. * \author Laurent Destailleur
  25. */
  26. require '../../main.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
  30. $langs->load("members");
  31. $langs->load("admin");
  32. $action=GETPOST('action', 'alpha');
  33. if (! $user->admin) accessforbidden();
  34. /*
  35. * Actions
  36. */
  37. if ($action == 'update')
  38. {
  39. $public=GETPOST('MEMBER_ENABLE_PUBLIC');
  40. $amount=GETPOST('MEMBER_NEWFORM_AMOUNT');
  41. $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
  42. $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE');
  43. $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity);
  44. $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity);
  45. $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity);
  46. $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity);
  47. if (! $res > 0) $error++;
  48. if (! $error)
  49. {
  50. $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
  51. }
  52. else
  53. {
  54. $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
  55. }
  56. }
  57. /*
  58. * View
  59. */
  60. $form=new Form($db);
  61. llxHeader('',$langs->trans("MembersSetup"));
  62. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  63. print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup');
  64. $head = member_admin_prepare_head();
  65. dol_fiche_head($head, 'public', $langs->trans("Member"), 0, 'user');
  66. dol_htmloutput_mesg($mesg);
  67. if ($conf->use_javascript_ajax)
  68. {
  69. print "\n".'<script type="text/javascript" language="javascript">';
  70. print 'jQuery(document).ready(function () {
  71. function initfields()
  72. {
  73. if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'0\')
  74. {
  75. jQuery(".drag").hide();
  76. }
  77. if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'1\')
  78. {
  79. jQuery(".drag").show();
  80. }
  81. }
  82. initfields();
  83. jQuery("#MEMBER_ENABLE_PUBLIC").change(function() {
  84. initfields();
  85. });
  86. })';
  87. print '</script>'."\n";
  88. }
  89. print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
  90. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  91. print '<input type="hidden" name="action" value="update">';
  92. print '<table class="noborder" width="100%">';
  93. print '<tr class="liste_titre">';
  94. print '<td>'.$langs->trans("Parameter").'</td>';
  95. print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
  96. print "</tr>\n";
  97. $var=true;
  98. // Allow public form
  99. $var=! $var;
  100. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  101. print '<tr '.$bc[$var].'><td>';
  102. print $langs->trans("EnablePublicSubscriptionForm");
  103. print '</td><td width="60" align="right">';
  104. print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
  105. print "</td></tr>\n";
  106. // Type
  107. /*$var=! $var;
  108. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  109. print '<tr '.$bcdd[$var].'><td>';
  110. print $langs->trans("EnablePublicSubscriptionForm");
  111. print '</td><td width="60" align="center">';
  112. print $form->selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1);
  113. print "</td></tr>\n"; */
  114. // Amount
  115. $var=! $var;
  116. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  117. print '<tr '.$bcdd[$var].'><td>';
  118. print $langs->trans("DefaultAmount");
  119. print '</td><td width="60" align="right">';
  120. print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';;
  121. print "</td></tr>\n";
  122. // Can edit
  123. $var=! $var;
  124. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  125. print '<tr '.$bcdd[$var].'><td>';
  126. print $langs->trans("CanEditAmount");
  127. print '</td><td width="60" align="right">';
  128. print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
  129. print "</td></tr>\n";
  130. if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
  131. {
  132. // Jump to an online payment page
  133. $var=! $var;
  134. print '<tr '.$bcdd[$var].'><td>';
  135. print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
  136. print '</td><td width="60" align="right">';
  137. $listofval=array();
  138. if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
  139. if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
  140. print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
  141. print "</td></tr>\n";
  142. }
  143. print '</table>';
  144. print '<center>';
  145. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  146. print '</center>';
  147. print '</form>';
  148. dol_fiche_end();
  149. print '<br>';
  150. //print $langs->trans('FollowingLinksArePublic').'<br>';
  151. print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
  152. print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php">'.DOL_MAIN_URL_ROOT.'/public/members/new.php</a>';
  153. /*
  154. print '<table class="border" cellspacing="0" cellpadding="3">';
  155. print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
  156. print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td>'..'</td></tr>';
  157. print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td>'.img_picto('','object_globe.png').' '.'<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
  158. print '<tr><td>'.$langs->trans("PublicMemberCard").'</td><td>'.img_picto('','object_globe.png').' '.DOL_MAIN_URL_ROOT.'/public/members/public_card.php?id=xxx'.'</td></tr>';
  159. print '</table>';
  160. */
  161. llxFooter();
  162. $db->close();
  163. ?>