ISPConfig module for simplify the creation of websites and DNS zones in a only step
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

304 lines
8.3 KiB

  1. <?php
  2. /*
  3. Form Definition
  4. Tabledefinition
  5. Datatypes:
  6. - INTEGER (Forces the input to Int)
  7. - DOUBLE
  8. - CURRENCY (Formats the values to currency notation)
  9. - VARCHAR (no format check, maxlength: 255)
  10. - TEXT (no format check)
  11. - DATE (Dateformat, automatic conversion to timestamps)
  12. Formtype:
  13. - TEXT (Textfield)
  14. - TEXTAREA (Textarea)
  15. - PASSWORD (Password textfield, input is not shown when edited)
  16. - SELECT (Select option field)
  17. - RADIO
  18. - CHECKBOX
  19. - CHECKBOXARRAY
  20. - FILE
  21. VALUE:
  22. - Wert oder Array
  23. Hint:
  24. The ID field of the database table is not part of the datafield definition.
  25. The ID field must be always auto incement (int or bigint).
  26. Search:
  27. - searchable = 1 or searchable = 2 include the field in the search
  28. - searchable = 1: this field will be the title of the search result
  29. - searchable = 2: this field will be included in the description of the search result
  30. */
  31. $form["title"] = "FTP User";
  32. $form["description"] = "";
  33. $form["name"] = "ftp_user";
  34. $form["action"] = "ftp_user_edit.php";
  35. $form["db_table"] = "ftp_user";
  36. $form["db_table_idx"] = "ftp_user_id";
  37. $form["db_history"] = "yes";
  38. $form["tab_default"] = "ftp";
  39. $form["list_default"] = "ftp_user_list.php";
  40. $form["auth"] = 'yes'; // yes / no
  41. $form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
  42. $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
  43. $form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
  44. $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
  45. $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
  46. $form["tabs"]['ftp'] = array (
  47. 'title' => "FTP User",
  48. 'width' => 100,
  49. 'template' => "templates/ftp_user_edit.htm",
  50. 'fields' => array (
  51. //#################################
  52. // Begin Datatable fields
  53. //#################################
  54. 'server_id' => array (
  55. 'datatype' => 'INTEGER',
  56. 'formtype' => 'SELECT',
  57. 'default' => '',
  58. 'datasource' => array ( 'type' => 'SQL',
  59. 'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
  60. 'keyfield'=> 'server_id',
  61. 'valuefield'=> 'server_name'
  62. ),
  63. 'value' => ''
  64. ),
  65. 'parent_domain_id' => array (
  66. 'datatype' => 'INTEGER',
  67. 'formtype' => 'SELECT',
  68. 'default' => '',
  69. 'datasource' => array ( 'type' => 'SQL',
  70. 'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
  71. 'keyfield'=> 'domain_id',
  72. 'valuefield'=> 'parent_domain'
  73. ),
  74. 'value' => ''
  75. ),
  76. 'username' => array (
  77. 'datatype' => 'VARCHAR',
  78. 'formtype' => 'TEXT',
  79. 'validators' => array ( 0 => array ( 'type' => 'UNIQUE',
  80. 'errmsg'=> 'username_error_unique'),
  81. 1 => array ( 'type' => 'REGEX',
  82. 'regex' => '/^[\w\.\-@\+]{0,64}$/',
  83. 'errmsg'=> 'username_error_regex'),
  84. ),
  85. 'default' => '',
  86. 'value' => '',
  87. 'width' => '30',
  88. 'maxlength' => '255',
  89. 'searchable' => 1
  90. ),
  91. 'username_prefix' => array (
  92. 'datatype' => 'VARCHAR',
  93. 'formtype' => 'TEXT',
  94. 'default' => '',
  95. 'value' => '',
  96. 'width' => '30',
  97. 'maxlength' => '25'
  98. ),
  99. 'password' => array (
  100. 'datatype' => 'VARCHAR',
  101. 'validators' => array(
  102. 0 => array(
  103. 'type' => 'CUSTOM',
  104. 'class' => 'validate_password',
  105. 'function' => 'password_check',
  106. 'errmsg' => 'weak_password_txt'
  107. )
  108. ),
  109. 'formtype' => 'PASSWORD',
  110. 'encryption' => 'CRYPT',
  111. 'default' => '',
  112. 'value' => '',
  113. 'width' => '30',
  114. 'maxlength' => '255'
  115. ),
  116. 'quota_size' => array (
  117. 'datatype' => 'INTEGER',
  118. 'formtype' => 'TEXT',
  119. 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
  120. 'errmsg'=> 'quota_size_error_empty'),
  121. 1 => array ( 'type' => 'REGEX',
  122. 'regex' => '/^(\-1|[0-9]{1,10})$/',
  123. 'errmsg'=> 'quota_size_error_regex'),
  124. ),
  125. 'default' => '-1',
  126. 'value' => '',
  127. 'width' => '7',
  128. 'maxlength' => '7'
  129. ),
  130. 'active' => array (
  131. 'datatype' => 'VARCHAR',
  132. 'formtype' => 'CHECKBOX',
  133. 'default' => 'y',
  134. 'value' => array(0 => 'n', 1 => 'y')
  135. ),
  136. //#################################
  137. // ENDE Datatable fields
  138. //#################################
  139. )
  140. );
  141. if($app->auth->is_admin()) {
  142. $form["tabs"]['advanced'] = array (
  143. 'title' => "Options",
  144. 'width' => 100,
  145. 'template' => "templates/ftp_user_advanced.htm",
  146. 'fields' => array (
  147. //#################################
  148. // Begin Datatable fields
  149. //#################################
  150. 'uid' => array (
  151. 'datatype' => 'VARCHAR',
  152. 'formtype' => 'TEXT',
  153. 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
  154. 'errmsg'=> 'uid_error_empty'),
  155. 1 => array(
  156. 'type' => 'CUSTOM',
  157. 'class' => 'validate_systemuser',
  158. 'function' => 'check_sysuser',
  159. 'check_names' => true,
  160. 'errmsg' => 'invalid_system_user_or_group_txt'
  161. ),
  162. ),
  163. 'default' => '0',
  164. 'value' => '',
  165. 'width' => '30',
  166. 'maxlength' => '255'
  167. ),
  168. 'gid' => array (
  169. 'datatype' => 'VARCHAR',
  170. 'formtype' => 'TEXT',
  171. 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
  172. 'errmsg'=> 'gid_error_empty'),
  173. 1 => array(
  174. 'type' => 'CUSTOM',
  175. 'class' => 'validate_systemuser',
  176. 'function' => 'check_sysgroup',
  177. 'check_names' => true,
  178. 'errmsg' => 'invalid_system_user_or_group_txt'
  179. ),
  180. ),
  181. 'default' => '0',
  182. 'value' => '',
  183. 'width' => '30',
  184. 'maxlength' => '255'
  185. ),
  186. 'dir' => array (
  187. 'datatype' => 'VARCHAR',
  188. 'formtype' => 'TEXT',
  189. 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
  190. 'errmsg'=> 'directory_error_empty'),
  191. 1 => array ( 'type' => 'REGEX',
  192. 'regex' => '/^\/[a-zA-Z0-9\ \.\-\_\/]{10,128}$/',
  193. 'errmsg'=> 'directory_error_regex'),
  194. 2 => array ( 'type' => 'CUSTOM',
  195. 'class' => 'validate_ftpuser',
  196. 'function' => 'ftp_dir',
  197. 'errmsg' => 'directory_error_notinweb'),
  198. ),
  199. 'default' => '',
  200. 'value' => '',
  201. 'width' => '30',
  202. 'maxlength' => '255'
  203. ),
  204. 'quota_files' => array (
  205. 'datatype' => 'INTEGER',
  206. 'formtype' => 'TEXT',
  207. 'default' => '0',
  208. 'value' => '',
  209. 'width' => '7',
  210. 'maxlength' => '7'
  211. ),
  212. 'ul_ratio' => array (
  213. 'datatype' => 'INTEGER',
  214. 'formtype' => 'TEXT',
  215. 'default' => '0',
  216. 'value' => '',
  217. 'width' => '7',
  218. 'maxlength' => '7'
  219. ),
  220. 'dl_ratio' => array (
  221. 'datatype' => 'INTEGER',
  222. 'formtype' => 'TEXT',
  223. 'default' => '0',
  224. 'value' => '',
  225. 'width' => '7',
  226. 'maxlength' => '7'
  227. ),
  228. 'ul_bandwidth' => array (
  229. 'datatype' => 'INTEGER',
  230. 'formtype' => 'TEXT',
  231. 'default' => '0',
  232. 'value' => '',
  233. 'width' => '7',
  234. 'maxlength' => '7'
  235. ),
  236. 'dl_bandwidth' => array (
  237. 'datatype' => 'INTEGER',
  238. 'formtype' => 'TEXT',
  239. 'default' => '0',
  240. 'value' => '',
  241. 'width' => '7',
  242. 'maxlength' => '7'
  243. ),
  244. //#################################
  245. // ENDE Datatable fields
  246. //#################################
  247. )
  248. );
  249. } else {
  250. $form["tabs"]['advanced'] = array (
  251. 'title' => "Options",
  252. 'width' => 100,
  253. 'template' => "templates/ftp_user_advanced_client.htm",
  254. 'fields' => array (
  255. //#################################
  256. // Begin Datatable fields
  257. //#################################
  258. 'dir' => array (
  259. 'datatype' => 'VARCHAR',
  260. 'formtype' => 'TEXT',
  261. 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
  262. 'errmsg'=> 'directory_error_empty'),
  263. 1 => array ( 'type' => 'CUSTOM',
  264. 'class' => 'validate_ftpuser',
  265. 'function' => 'ftp_dir',
  266. 'errmsg' => 'directory_error_notinweb'),
  267. ),
  268. 'default' => '',
  269. 'value' => '',
  270. 'width' => '30',
  271. 'maxlength' => '255'
  272. ),
  273. //#################################
  274. // ENDE Datatable fields
  275. //#################################
  276. )
  277. );
  278. }
  279. $form['tabs']['advanced']['fields']['expires'] = array(
  280. 'datatype' => 'DATETIME',
  281. 'formtype' => 'DATETIME'
  282. );
  283. ?>