PageRenderTime 39ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/frontend/php/register/projectname.php

#
PHP | 128 lines | 71 code | 25 blank | 32 comment | 7 complexity | 89fb510eb802a3d64f202d6ece9f3557 MD5 | raw file
Possible License(s): AGPL-3.0
  1. <?php
  2. # <one line to give a brief idea of what this does.>
  3. #
  4. # Copyright 1999-2000 (c) The SourceForge Crew
  5. # Copyright 2003-2006 (c) Mathieu Roy <yeupou--gnu.org>
  6. #
  7. # This file is part of Savane.
  8. #
  9. # Savane is free software: you can redistribute it and/or modify
  10. # it under the terms of the GNU Affero General Public License as
  11. # published by the Free Software Foundation, either version 3 of the
  12. # License, or (at your option) any later version.
  13. #
  14. # Savane is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU Affero General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Affero General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. require_once('../include/init.php');
  22. require_once('../include/exit.php');
  23. require_once('../include/account.php');
  24. require_once('../include/Group.class');
  25. session_require(array('isloggedin' => '1'));
  26. extract(sane_import('post',
  27. array('insert_purpose', 'form_purpose', 'form_required_sw',
  28. 'form_comments', 'form_full_name', 'form_unix_name')));
  29. # push received vars
  30. if ($insert_purpose && $form_purpose) {
  31. mt_srand((double)microtime()*1000000);
  32. $random_num=mt_rand(0,1000000);
  33. # make group entry
  34. $result = db_query_escape(
  35. "INSERT INTO groups (group_name,is_public,unix_group_name,status,license,
  36. register_purpose,required_software,
  37. other_comments,register_time,
  38. license_other,rand_hash)
  39. VALUES ('__%s',1,'__%s','I','__%s',
  40. '%s','%s',
  41. '%s','%s',
  42. '__%s','__%s')",
  43. $random_num, $random_num, $random_num,
  44. htmlspecialchars($form_purpose), htmlspecialchars($form_required_sw),
  45. htmlspecialchars($form_comments), time(),
  46. $random_num, md5($random_num)
  47. );
  48. if (!$result)
  49. {
  50. unset($group_id);
  51. exit_error('ERROR','INSERT QUERY FAILED. Please notify '
  52. . $GLOBALS['sys_mail_admin'].'@'.$GLOBALS['sys_mail_domain']);
  53. }
  54. else
  55. {
  56. $group_id=db_insertid($result);
  57. }
  58. } elseif (!$form_full_name && !$form_unix_name) {
  59. unset($group_id);
  60. exit_error('Error','Missing Information. PLEASE fill in all required information.');
  61. }
  62. # Create the page header just like if there was not yet any group_id
  63. $group_id_not_yet_valid = $group_id;
  64. unset($group_id);
  65. $HTML->header(array('title'=>_("Step 3: Project Name")));
  66. $group_id = $group_id_not_yet_valid;
  67. # get site-specific content
  68. utils_get_content("register/projectname");
  69. # FIXME: begin
  70. #if ($need_to_print_warning) {
  71. # print '<p><span class="error">'.projectname_test_error_message().'</span>';
  72. #}
  73. # FIXME: end
  74. print '<p>'._("Please complete both fields").'.</p>';
  75. print '<form action="license.php" method="post">';
  76. #FIXME
  77. #if (isset($test_on_name)) { echo '<input type="hidden" name="test_on_name" value="'.$test_on_name.'" />'; }
  78. if (isset($re_license_other)) { echo '<input type="hidden" name="re_license_other" value="'.$re_license_other.'" />'; }
  79. print '<input type="hidden" name="insert_group_name" value="y" />';
  80. print '<input type="hidden" name="group_id" value="'.$group_id.'" />';
  81. print '<input type="hidden" name="rand_hash" value="'.(isset($rand_hash) ? $rand_hash : md5($random_num)).'" />';
  82. # If we are creating the local admin project, system unix group name cannot be
  83. # changed and we make a proposal for the full name
  84. if (!group_getid($GLOBALS['sys_unix_group_name']))
  85. {
  86. print '<h3>'._("Full Name").' :</h3>';
  87. print '<input size="60" maxlength="254" type="text" name="form_full_name" value="Site Administration" />';
  88. print '<h3>'._("System Name").' :</h3>';
  89. print '<input type="hidden" name="form_unix_name" value="'.$GLOBALS['sys_unix_group_name'].'" /><strong>'.$GLOBALS['sys_unix_group_name'].'</strong>';
  90. }
  91. else
  92. {
  93. print '<h3>'._("Full Name").' :</h3>';
  94. print '<input size="60" maxlength="254" type="text" name="form_full_name"'.(isset($re_full_name) ? " value=\"$re_full_name\"":"").' />';
  95. print '<h3>'._("System Name").' :</h3>';
  96. print '<input type="text" maxlength="16" size="15" name="form_unix_name"'.(isset($re_unix_name) ? " value=\"$re_unix_name\"":"").' /><br /><br />';
  97. }
  98. print '<div align="center">';
  99. print '<input type=submit name="Submit" value="'._("Step 4: License").'" />';
  100. print '</div>';
  101. print '</form>';
  102. print '<div align="center"><span class="error">'._("Do not click back button after this point (unless asked to).").'</span></div>';
  103. $HTML->footer(array());