Posted By

weitzman on 08/16/06


Tagged


Versions (?)

tmp


 / Published in: Diff
 

  1. === modified file 'includes/form.inc'
  2. --- includes/form.inc
  3. +++ includes/form.inc
  4. @@ -12,7 +12,67 @@
  5. * http://api.drupal.org/api/HEAD/file/developer/topics/forms_api_reference.html
  6. * and the quickstart guide at
  7. * http://api.drupal.org/api/HEAD/file/developer/topics/forms_api.html
  8. + *
  9. + * If you want to programatically submit a form, you need to
  10. + * retrieve the form, load name/value pairs into $form['#post'] and then
  11. + * call drupal_process_form(). Example:
  12. + *
  13. + * // register a new user.
  14. + * $form = drupal_retrieve_form('user_register');
  15. + * $form['#post']['edit']['name'] = 'robo-user';
  16. + * $form['#post']['mail'] = '[email protected]';
  17. + * $output = drupal_process_form('user_register', $form);
  18. + *
  19. + */
  20. +
  21. +/**
  22. + * Retrieves a form from a handler function, then passes it on for
  23. + * processing and rendering.
  24. + *
  25. + * @param $form_id
  26. + * The unique string identifying the form.
  27. + * @param ...
  28. + * Any additional arguments needed by the form handler.
  29. + * @return
  30. + * The rendered form.
  31. */
  32. +function drupal_get_form($form_id) {
  33. + $args = func_get_args();
  34. + $form = call_user_func_array('drupal_retrieve_form', $args);
  35. + return drupal_process_form($form_id, $form);
  36. +}
  37. +
  38. +/**
  39. + * Retrieves the structured array that defines a given form.
  40. + *
  41. + * @param $form_id
  42. + * The unique string identifying the desired form. If $form_id
  43. + * exists as a function, it is called to build the form. Otherwise,
  44. + * hook_forms() is called to build a system-wide array of forms,
  45. + * and $form_id is used as a key to locate the appropriate
  46. + * builder-function in that array.
  47. + * @param ...
  48. + * Any additional arguments needed by the form handler.
  49. + */
  50. +function drupal_retrieve_form($form_id) {
  51. + static $forms;
  52. +
  53. + $args = func_get_args();
  54. + array_shift($args);
  55. + if (!function_exists($form_id)) {
  56. + if (!isset($forms)) {
  57. + $forms = module_invoke_all('forms');
  58. + }
  59. + $form_definition = $forms[$form_id];
  60. + if (isset($form_definition['callback arguments'])) {
  61. + $args = array_merge($form_definition['callback arguments'], $args);
  62. + }
  63. + if (isset($form_definition['callback'])) {
  64. + $callback = $form_definition['callback'];
  65. + }
  66. + }
  67. + return call_user_func_array(isset($callback) ? $callback : $form_id, $args);
  68. +}
  69.  
  70. /**
  71. * Processes a form array and produces the HTML output of a form.
  72. @@ -21,19 +81,26 @@
  73. * and then submit the form using drupal_submit_form().
  74. *
  75. * @param $form_id
  76. - * A unique string identifying the form. Allows each form to be
  77. - * themed. Pass NULL to suppress the form_id parameter (produces
  78. - * a shorter URL with method=get)
  79. + * The unique string identifying the current form.
  80. * @param $form
  81. * An associative array containing the structure of the form.
  82. - * @param $callback
  83. - * An optional callback that will be used in addition to the form_id.
  84. - *
  85. */
  86. -function drupal_get_form($form_id, &$form, $callback = NULL) {
  87. +function drupal_process_form($form_id, $form) {
  88. global $form_values, $form_submitted, $user, $form_button_counter;
  89. static $saved_globals = array();
  90.  
  91. + if (!isset($form['#post'])) {
  92. + $form['#post'] = $_POST;
  93. + $form['#programmed'] = FALSE;
  94. + }
  95. + else {
  96. + $form['#programmed'] = TRUE;
  97. + }
  98. +
  99. + if (isset($form['#base'])) {
  100. + $base = $form['#base'];
  101. + }
  102. +
  103. // Save globals in case of indirect recursive call
  104. array_push($saved_globals, array($form_values, $form_submitted, $form_button_counter));
  105.  
  106. @@ -41,20 +108,24 @@ function drupal_get_form($form_id, &$for
  107. $form_submitted = FALSE;
  108. $form_button_counter = array(0, 0);
  109.  
  110. - $form = drupal_build_form($form_id, $form, $callback);
  111. + $form = drupal_build_form($form_id, $form, $base);
  112.  
  113. - if (!empty($_POST['edit']) && (($_POST['edit']['form_id'] == $form_id) || ($_POST['edit']['form_id'] == $callback))) {
  114. - drupal_validate_form($form_id, $form, $callback);
  115. + if (($form['#programmed']) || (!empty($_POST['edit']) && (($_POST['edit']['form_id'] == $form_id) || ($_POST['edit']['form_id'] == $base)))) {
  116. + drupal_validate_form($form_id, $form);
  117. // IE does not send a button value when there is only one submit button (and no non-submit buttons)
  118. // and you submit by pressing enter.
  119. // In that case we accept a submission without button values.
  120. - if (($form_submitted || (!$form_button_counter[0] && $form_button_counter[1])) && !form_get_errors()) {
  121. - $redirect = drupal_submit_form($form_id, $form, $callback);
  122. - drupal_redirect_form($form, $redirect);
  123. + if ((($form['#programmed']) || $form_submitted || (!$form_button_counter[0] && $form_button_counter[1])) && !form_get_errors()) {
  124. + $redirect = drupal_submit_form($form_id, $form);
  125. + if (!$form['#programmed']) {
  126. + drupal_redirect_form($form, $redirect);
  127. + }
  128. }
  129. }
  130.  
  131. - $output = drupal_render_form($form_id, $form, $callback);
  132. + if (!$form['#programmed']) {
  133. + $output = drupal_render_form($form_id, $form, $base);
  134. + }
  135. list($form_values, $form_submitted, $form_button_counter) = array_pop($saved_globals);
  136. return $output;
  137. }
  138. @@ -69,11 +140,11 @@ function drupal_get_form($form_id, &$for
  139. * theming, and hook_form_alter functions.
  140. * @param $form
  141. * An associative array containing the structure of the form.
  142. - * @param $callback
  143. - * An optional callback that will be used in addition to the form_id.
  144. + * @param $base
  145. + * An optional function prefix that will be used in place of $form_id.
  146. *
  147. */
  148. -function drupal_build_form($form_id, &$form, $callback = NULL) {
  149. +function drupal_build_form($form_id, &$form, $base = NULL) {
  150. $form['#type'] = 'form';
  151. if (isset($form['#token'])) {
  152. // If the page cache is on and an anonymous user issues a GET request,
  153. @@ -105,8 +176,8 @@ function drupal_build_form($form_id, &$f
  154. if (function_exists($form_id .'_validate')) {
  155. $form['#validate'] = array($form_id .'_validate' => array());
  156. }
  157. - elseif (function_exists($callback .'_validate')) {
  158. - $form['#validate'] = array($callback .'_validate' => array());
  159. + elseif (function_exists($base .'_validate')) {
  160. + $form['#validate'] = array($base .'_validate' => array());
  161. }
  162. }
  163.  
  164. @@ -116,8 +187,8 @@ function drupal_build_form($form_id, &$f
  165. // $form_values because it will change later
  166. $form['#submit'] = array($form_id .'_submit' => array());
  167. }
  168. - elseif (function_exists($callback .'_submit')) {
  169. - $form['#submit'] = array($callback .'_submit' => array());
  170. + elseif (function_exists($base .'_submit')) {
  171. + $form['#submit'] = array($base .'_submit' => array());
  172. }
  173. }
  174.  
  175. @@ -141,11 +212,9 @@ function drupal_build_form($form_id, &$f
  176. * theming, and hook_form_alter functions.
  177. * @param $form
  178. * An associative array containing the structure of the form.
  179. - * @param $callback
  180. - * An optional callback that will be used in addition to the form_id.
  181. *
  182. */
  183. -function drupal_validate_form($form_id, $form, $callback = NULL) {
  184. +function drupal_validate_form($form_id, $form) {
  185. global $form_values;
  186. static $validated_forms = array();
  187.  
  188. @@ -175,14 +244,12 @@ function drupal_validate_form($form_id,
  189. * theming, and hook_form_alter functions.
  190. * @param $form
  191. * An associative array containing the structure of the form.
  192. - * @param $callback
  193. - * An optional callback that will be used in addition to the form_id.
  194. * @return
  195. * A string containing the path of the page to display when processing
  196. * is complete.
  197. *
  198. */
  199. -function drupal_submit_form($form_id, $form, $callback = NULL) {
  200. +function drupal_submit_form($form_id, $form) {
  201. global $form_values;
  202. $default_args = array($form_id, &$form_values);
  203.  
  204. @@ -209,21 +276,21 @@ function drupal_submit_form($form_id, $f
  205. * theming, and hook_form_alter functions.
  206. * @param $form
  207. * An associative array containing the structure of the form.
  208. - * @param $callback
  209. - * An optional callback that will be used in addition to the form_id.
  210. + * @param $base
  211. + * An optional function prefix that will be used in addition to the form_id.
  212. * @return
  213. * A string containing the path of the page to display when processing
  214. * is complete.
  215. *
  216. */
  217. -function drupal_render_form($form_id, &$form, $callback = NULL) {
  218. +function drupal_render_form($form_id, &$form, $base = NULL) {
  219. // Don't override #theme if someone already set it.
  220. if (!isset($form['#theme'])) {
  221. if (theme_get_function($form_id)) {
  222. $form['#theme'] = $form_id;
  223. }
  224. - elseif (theme_get_function($callback)) {
  225. - $form['#theme'] = $callback;
  226. + elseif (theme_get_function($base)) {
  227. + $form['#theme'] = $base;
  228. }
  229. }
  230.  
  231. @@ -408,8 +475,8 @@ function form_builder($form_id, $form) {
  232. $form['#id'] = 'edit-' . implode('-', $form['#parents']);
  233. }
  234.  
  235. - $posted = (isset($_POST['edit']) && ($_POST['edit']['form_id'] == $form_id));
  236. - $edit = $posted ? $_POST['edit'] : array();
  237. + $posted = (($form['#programmed']) || (isset($_POST['edit']) && ($_POST['edit']['form_id'] == $form_id)));
  238. + $edit = $posted ? $form['#post']['edit'] : array();
  239. foreach ($form['#parents'] as $parent) {
  240. $edit = isset($edit[$parent]) ? $edit[$parent] : NULL;
  241. }
  242. @@ -490,6 +557,8 @@ function form_builder($form_id, $form) {
  243. // Recurse through all child elements.
  244. $count = 0;
  245. foreach (element_children($form) as $key) {
  246. + $form[$key]['#post'] = $form['#post'];
  247. + $form[$key]['#programmed'] = $form['#programmed'];
  248. // don't squash an existing tree value
  249. if (!isset($form[$key]['#tree'])) {
  250. $form[$key]['#tree'] = $form['#tree'];
  251. @@ -769,7 +838,7 @@ function password_confirm_validate($form
  252. form_error($form, t('The specified passwords do not match.'));
  253. }
  254. }
  255. - elseif ($form['#required'] && !empty($_POST['edit'])) {
  256. + elseif ($form['#required'] && !empty($form['#post']['edit'])) {
  257. form_error($form, t('Password field is required.'));
  258. }
  259.  
  260. === modified file 'includes/menu.inc'
  261. --- includes/menu.inc
  262. +++ includes/menu.inc
  263. @@ -415,7 +415,15 @@ function menu_execute_active_handler() {
  264. $arguments = array_merge($arguments, explode('/', $arg));
  265. }
  266.  
  267. - return call_user_func_array($menu['callbacks'][$path]['callback'], $arguments);
  268. + $callback = $menu['callbacks'][$path]['callback'];
  269. + $return = call_user_func_array($callback, $arguments);
  270. +
  271. + // A menu callback that returns an array always consists of a form definition. Then we push $return to
  272. + // drupal_process_form(). Modules may submit forms programmatically using an analogous "push".
  273. + if (is_array($return)) {
  274. + return drupal_process_form($callback, $return);
  275. + }
  276. + return $return;
  277. }
  278.  
  279. /**
  280. === modified file 'install.php'
  281. --- install.php
  282. +++ install.php
  283. @@ -101,7 +101,7 @@ function install_verify_settings() {
  284. $db_path = ltrim(urldecode($url['path']), '/');
  285. $settings_file = './'. conf_path() .'/settings.php';
  286.  
  287. - _install_settings_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_path, $settings_file);
  288. + _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_path, $settings_file);
  289. if (!form_get_errors()) {
  290. return TRUE;
  291. }
  292. @@ -124,13 +124,12 @@ function install_change_settings() {
  293.  
  294. // We always need this because we want to run form_get_errors.
  295. include_once './includes/form.inc';
  296. + drupal_maintenance_theme();
  297.  
  298. // The existing database settings are not working, so we need write access
  299. // to settings.php to change them.
  300. if (!drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_WRITABLE)) {
  301. - drupal_maintenance_theme();
  302. drupal_set_message(st('The Drupal installer requires write permissions to %file during the installation process.', array('%file' => $settings_file)), 'error');
  303. -
  304. drupal_set_title('Drupal database setup');
  305. print theme('install_page', '');
  306. exit;
  307. @@ -141,8 +140,18 @@ function install_change_settings() {
  308. $db_user = $db_pass = $db_path = '';
  309. }
  310.  
  311. + $output = drupal_get_form('install_settings_form', $profile, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host);
  312. + drupal_set_title('Database configuration');
  313. + print theme('install_page', $output);
  314. + exit;
  315. +}
  316. +
  317.  
  318. +/**
  319. + * Form API array definition for install_settings.
  320. + */
  321.  
  322. +function install_settings_form($profile, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host) {
  323. $db_types = drupal_detect_database_types();
  324. if (count($db_types) == 0) {
  325. $form['no_db_types'] = array(
  326. @@ -251,26 +260,21 @@ function install_change_settings() {
  327. $form['_db_url'] = array('#type' => 'value');
  328. $form['#action'] = "install.php?profile=$profile";
  329. $form['#redirect'] = NULL;
  330. - drupal_maintenance_theme();
  331. }
  332. - $output = drupal_get_form('install_settings', $form);
  333. - drupal_set_title('Database configuration');
  334. - print theme('install_page', $output);
  335. - exit;
  336. + return $form;
  337. }
  338. -
  339. /**
  340. * Form API validate for install_settings form.
  341. */
  342. -function install_settings_validate($form_id, $form_values, $form) {
  343. +function install_settings_form_validate($form_id, $form_values, $form) {
  344. global $db_url;
  345. - _install_settings_validate($form_values['db_prefix'], $form_values['db_type'], $form_values['db_user'], $form_values['db_pass'], $form_values['db_host'], $form_values['db_path'], $form_values['settings_file'], $form);
  346. + _install_settings_form_validate($form_values['db_prefix'], $form_values['db_type'], $form_values['db_user'], $form_values['db_pass'], $form_values['db_host'], $form_values['db_path'], $form_values['settings_file'], $form);
  347. }
  348.  
  349. /**
  350. * Helper function for install_settings_validate.
  351. */
  352. -function _install_settings_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_path, $settings_file, $form = NULL) {
  353. +function _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_path, $settings_file, $form = NULL) {
  354. global $db_url;
  355.  
  356. // Check for default username/password
  357. @@ -314,7 +318,7 @@ function _install_settings_validate($db_
  358. /**
  359. * Form API submit for install_settings form.
  360. */
  361. -function install_settings_submit($form_id, $form_values) {
  362. +function install_settings_form_submit($form_id, $form_values) {
  363. global $profile;
  364.  
  365. // Update global settings array and save
  366. @@ -350,42 +354,46 @@ function install_select_profile() {
  367. return $profile->name;
  368. }
  369. elseif (sizeof($profiles) > 1) {
  370. - drupal_maintenance_theme();
  371. - $form = '';
  372. foreach ($profiles as $profile) {
  373. - include_once($profile->filename);
  374. if ($_POST['edit']['profile'] == $profile->name) {
  375. return $profile->name;
  376. }
  377. - // Load profile details.
  378. - $function = $profile->name .'_profile_details';
  379. - if (function_exists($function)) {
  380. - $details = $function();
  381. - }
  382. -
  383. - // If set, used defined name. Otherwise use file name.
  384. - $name = isset($details['name']) ? $details['name'] : $profile->name;
  385. -
  386. - $form['profile'][$name] = array(
  387. - '#type' => 'radio',
  388. - '#value' => 'default',
  389. - '#return_value' => $profile->name,
  390. - '#title' => $name,
  391. - '#description' => isset($details['description']) ? $details['description'] : '',
  392. - '#parents' => array('profile'),
  393. - );
  394. }
  395. - $form['submit'] = array(
  396. - '#type' => 'submit',
  397. - '#value' => 'Save configuration',
  398. - );
  399. +
  400. + drupal_maintenance_theme();
  401.  
  402. drupal_set_title('Select an installation profile');
  403. - print theme('install_page', drupal_get_form('install_select_profile', $form));
  404. + print theme('install_page', drupal_get_form('install_select_profile_form', $profiles));
  405. exit;
  406. }
  407. }
  408.  
  409. +function install_select_profile_form($profiles) {
  410. + foreach ($profiles as $profile) {
  411. + include_once($profile->filename);
  412. + // Load profile details.
  413. + $function = $profile->name .'_profile_details';
  414. + if (function_exists($function)) {
  415. + $details = $function();
  416. + }
  417. + // If set, used defined name. Otherwise use file name.
  418. + $name = isset($details['name']) ? $details['name'] : $profile->name;
  419. + $form['profile'][$name] = array(
  420. + '#type' => 'radio',
  421. + '#value' => 'default',
  422. + '#return_value' => $profile->name,
  423. + '#title' => $name,
  424. + '#description' => isset($details['description']) ? $details['description'] : '',
  425. + '#parents' => array('profile'),
  426. + );
  427. + }
  428. + $form['submit'] = array(
  429. + '#type' => 'submit',
  430. + '#value' => 'Save configuration',
  431. + );
  432. + return $form;
  433. +}
  434. +
  435. /**
  436. * Show an error page when there are no profiles available.
  437. */
  438. === modified file 'modules/aggregator/aggregator.module'
  439. --- modules/aggregator/aggregator.module
  440. +++ modules/aggregator/aggregator.module
  441. @@ -170,9 +170,9 @@ function aggregator_menu($may_cache) {
  442. }
  443. }
  444. }
  445. - else if (arg(1) == 'aggregator' && is_numeric(arg(4))) {
  446. - if (arg(3) == 'feed') {
  447. - $feed = aggregator_get_feed(arg(4));
  448. + else if (arg(2) == 'aggregator' && is_numeric(arg(5))) {
  449. + if (arg(4) == 'feed') {
  450. + $feed = aggregator_get_feed(arg(5));
  451. if ($feed) {
  452. $items[] = array('path' => 'admin/content/aggregator/edit/feed/'. $feed['fid'],
  453. 'title' => t('edit feed'),
  454. @@ -183,7 +183,7 @@ function aggregator_menu($may_cache) {
  455. }
  456. }
  457. else {
  458. - $category = aggregator_get_category(arg(4));
  459. + $category = aggregator_get_category(arg(5));
  460. if ($category) {
  461. $items[] = array('path' => 'admin/content/aggregator/edit/category/'. $category['cid'],
  462. 'title' => t('edit category'),
  463. @@ -227,7 +227,7 @@ function aggregator_admin_settings() {
  464. '#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
  465. );
  466.  
  467. - return system_settings_form('aggregator_admin_settings', $form);
  468. + return system_settings_form($form);
  469. }
  470.  
  471. /**
  472. @@ -336,7 +336,7 @@ function aggregator_block($op, $delta =
  473. $form['cid'] = array('#type' => 'hidden', '#value' => $edit['cid']);
  474. }
  475.  
  476. - return drupal_get_form('aggregator_form_category', $form);
  477. + return $form;
  478. }
  479.  
  480. /**
  481. @@ -467,7 +467,7 @@ function aggregator_form_feed($edit = ar
  482. $form['fid'] = array('#type' => 'hidden', '#value' => $edit['fid']);
  483. }
  484.  
  485. - return drupal_get_form('aggregator_form_feed', $form);
  486. + return $form;
  487. }
  488.  
  489. /**
  490. @@ -1049,28 +1049,15 @@ function aggregator_page_category() {
  491. return _aggregator_page_list('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = '. $category->cid .' ORDER BY timestamp DESC, iid DESC', arg(3));
  492. }
  493.  
  494. -/**
  495. - * Prints an aggregator page listing a number of feed items. Various
  496. - * menu callbacks use this function to print their feeds.
  497. - */
  498. -function _aggregator_page_list($sql, $op, $header = '') {
  499. - $categorize = (user_access('administer news feeds') && ($op == 'categorize'));
  500. -
  501. - $output = '<div id="aggregator">';
  502. -
  503. +function aggregator_page_list($sql, $header, $categorize) {
  504. $form['header'] = array('#value' => $header);
  505. - $output .= $form['header']['#value'];
  506. -
  507. $result = pager_query($sql, 20);
  508. $categories = array();
  509. $done = FALSE;
  510. while ($item = db_fetch_object($result)) {
  511. $form['items'][$item->iid] = array('#value' => theme('aggregator_page_item', $item));
  512. - $output .= $form['items'][$item->iid]['#value'];
  513. $form['categories'][$item->iid] = array();
  514. -
  515. if ($categorize) {
  516. -
  517. $categories_result = db_query('SELECT c.cid, c.title, ci.iid FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid AND ci.iid = %d', $item->iid);
  518. $selected = array();
  519. while ($category = db_fetch_object($categories_result)) {
  520. @@ -1089,11 +1076,8 @@ function _aggregator_page_list($sql, $op
  521. );
  522. }
  523. }
  524. - $output .= '</div>';
  525. $form['submit'] = array('#type' => 'submit', '#value' => t('Save categories'));
  526. $form['pager'] = array('#value' => theme('pager', NULL, 20, 0));
  527. - $output .= $form['pager']['#value'];
  528. -
  529. // arg(1) is undefined if we are at the top aggregator URL
  530. // is there a better way to do this?
  531. if (!arg(1)) {
  532. @@ -1102,9 +1086,30 @@ function _aggregator_page_list($sql, $op
  533. elseif (arg(1) == 'categories' && arg(2) && !arg(3)) {
  534. $form['feed_icon'] = array('#value' => theme('feed_icon', url('aggregator/rss/' . arg(2))));
  535. }
  536. - $output .= $form['feed_icon']['#value'];
  537. + return $form;
  538. +}
  539.  
  540. - return ($categorize) ? drupal_get_form('aggregator_page_list', $form) : $output;
  541. +/**
  542. + * Prints an aggregator page listing a number of feed items. Various
  543. + * menu callbacks use this function to print their feeds.
  544. + */
  545. +function _aggregator_page_list($sql, $op, $header = '') {
  546. + $categorize = (user_access('administer news feeds') && ($op == 'categorize'));
  547. + $form = aggregator_page_list($sql, $header, $categorize);
  548. + if ($categorize) {
  549. + return $form;
  550. + }
  551. + else {
  552. + $output = '<div id="aggregator">';
  553. + $output .= $header;
  554. + foreach ($form['items'] as $item) {
  555. + $output .= $item['#value'];
  556. + }
  557. + $output .= '</div>';
  558. + $output .= $form['pager']['#value'];
  559. + $output .= $form['feed_icon']['#value'];
  560. + return $output;
  561. + }
  562. }
  563.  
  564. function theme_aggregator_page_list($form) {
  565. === modified file 'modules/block/block.module'
  566. --- modules/block/block.module
  567. +++ modules/block/block.module
  568. @@ -84,7 +84,7 @@ function block_menu($may_cache) {
  569. 'type' => MENU_CALLBACK);
  570. $items[] = array('path' => 'admin/build/block/add', 'title' => t('add block'),
  571. 'access' => user_access('administer blocks'),
  572. - 'callback' => 'block_box_add',
  573. + 'callback' => 'block_box_form',
  574. 'type' => MENU_LOCAL_TASK);
  575. foreach (list_themes() as $key => $theme) {
  576. if ($theme->status) {
  577. @@ -245,7 +245,7 @@ function block_admin_display($theme = NU
  578. }
  579. $form['submit'] = array('#type' => 'submit', '#value' => t('Save blocks'));
  580.  
  581. - return drupal_get_form('block_admin_display', $form);
  582. + return $form;
  583. }
  584.  
  585. /**
  586. @@ -468,7 +468,7 @@ function block_admin_configure($module =
  587. '#value' => t('Save block'),
  588. );
  589.  
  590. - return drupal_get_form('block_admin_configure', $form);
  591. + return $form;
  592. }
  593.  
  594. function block_admin_configure_validate($form_id, $form_values) {
  595. @@ -493,23 +493,13 @@ function block_admin_configure_submit($f
  596. }
  597. }
  598.  
  599. -/**
  600. - * Menu callback; displays the block creation form.
  601. - */
  602. -function block_box_add() {
  603. - $form = block_box_form();
  604. - $form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
  605. -
  606. - return drupal_get_form('block_box_add', $form);
  607. -}
  608. -
  609. -function block_box_add_validate($form_id, $form_values) {
  610. +function block_box_form_validate($form_id, $form_values) {
  611. if (empty($form_values['info']) || db_num_rows(db_query("SELECT info FROM {boxes} WHERE info = '%s'", $form_values['info']))) {
  612. form_set_error('info', t('Please ensure that each block description is unique.'));
  613. }
  614. }
  615.  
  616. -function block_box_add_submit($form_id, $form_values) {
  617. +function block_box_form_submit($form_id, $form_values) {
  618. if (!form_get_errors()) {
  619. if (block_box_save($form_values)) {
  620. drupal_set_message(t('The block has been created.'));
  621. @@ -526,13 +516,13 @@ function block_box_delete($bid = 0) {
  622. $form['info'] = array('#type' => 'hidden', '#value' => $box['info'] ? $box['info'] : $box['title']);
  623. $form['bid'] = array('#type' => 'hidden', '#value' => $bid);
  624.  
  625. - return confirm_form('block_box_delete_confirm', $form, t('Are you sure you want to delete the block %name?', array('%name' => theme('placeholder', $box['info']))), 'admin/build/block', '', t('Delete'), t('Cancel'));
  626. + return confirm_form($form, t('Are you sure you want to delete the block %name?', array('%name' => theme('placeholder', $box['info']))), 'admin/build/block', '', t('Delete'), t('Cancel'));
  627. }
  628.  
  629. /**
  630. * Deletion of custom blocks.
  631. */
  632. -function block_box_delete_confirm_submit($form_id, $form_values) {
  633. +function block_box_delete_submit($form_id, $form_values) {
  634. db_query('DELETE FROM {boxes} WHERE bid = %d', $form_values['bid']);
  635. drupal_set_message(t('The block %name has been removed.', array('%name' => theme('placeholder', $form_values['info']))));
  636. cache_clear_all();
  637. @@ -567,6 +557,7 @@ function block_box_form($edit = array())
  638. '#weight' => -17,
  639. );
  640. $form['body_filter']['format'] = filter_form($edit['format'], -16);
  641. + $form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
  642.  
  643. return $form;
  644. }
  645. === modified file 'modules/blogapi/blogapi.module'
  646. --- modules/blogapi/blogapi.module
  647. +++ modules/blogapi/blogapi.module
  648. @@ -556,7 +556,7 @@ function blogapi_admin_settings() {
  649. '#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
  650. );
  651.  
  652. - return system_settings_form('blogapi_admin_settings', $form);
  653. + return system_settings_form($form);
  654. }
  655.  
  656. function blogapi_menu($may_cache) {
  657. === modified file 'modules/book/book.module'
  658. --- modules/book/book.module
  659. +++ modules/book/book.module
  660. @@ -324,7 +324,7 @@ function book_outline($nid) {
  661. }
  662.  
  663. drupal_set_title(check_plain($node->title));
  664. - return drupal_get_form('book_outline', $form);
  665. + return $form;
  666. }
  667.  
  668. /**
  669. @@ -891,7 +891,7 @@ function book_admin_edit($nid) {
  670. '#value' => t('Save book pages'),
  671. );
  672.  
  673. - return drupal_get_form('book_admin_edit', $form);
  674. + return $form;
  675. }
  676. else {
  677. drupal_not_found();
  678. @@ -919,19 +919,18 @@ function book_admin_orphan() {
  679. }
  680.  
  681. if (count($orphans)) {
  682. - $form = array();
  683. -
  684. $form['table'] = _book_admin_table($orphans);
  685. $form['save'] = array(
  686. '#type' => 'submit',
  687. '#value' => t('Save book pages'),
  688. );
  689.  
  690. - return drupal_get_form('book_admin_edit', $form);
  691. }
  692. else {
  693. - return '<p>'. t('There are no orphan pages.') .'</p>';
  694. + $form['error'] = array('#value' => '<p>'. t('There are no orphan pages.') .'</p>');
  695. }
  696. + $form['#function_prefix'] = 'book_admin_edit';
  697. + return $form;
  698. }
  699.  
  700. function book_admin_edit_submit($form_id, $form_values) {
  701. === modified file 'modules/comment/comment.module'
  702. --- modules/comment/comment.module
  703. +++ modules/comment/comment.module
  704. @@ -466,7 +466,7 @@ function comment_admin_settings() {
  705. '#options' => array(t('Display on separate page'), t('Display below post or comments')),
  706. );
  707.  
  708. - return system_settings_form('comment_admin_settings', $form);
  709. + return system_settings_form($form);
  710. }
  711.  
  712. /**
  713. @@ -496,7 +496,7 @@ function comment_edit($cid) {
  714. $comment = drupal_unpack($comment);
  715. $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
  716. if (comment_access('edit', $comment)) {
  717. - return comment_form((array)$comment);
  718. + return comment_form_box((array)$comment);
  719. }
  720. else {
  721. drupal_access_denied();
  722. @@ -517,7 +517,7 @@ function comment_reply($nid, $pid = NULL
  723.  
  724. if ($op == t('Preview comment')) {
  725. if (user_access('post comments')) {
  726. - $output .= comment_form(array('pid' => $pid, 'nid' => $nid), NULL);
  727. + $output .= comment_form_box(array('pid' => $pid, 'nid' => $nid), NULL);
  728. }
  729. else {
  730. drupal_set_message(t('You are not authorized to post comments.'), 'error');
  731. @@ -553,7 +553,7 @@ function comment_reply($nid, $pid = NULL
  732. drupal_goto("node/$nid");
  733. }
  734. else if (user_access('post comments')) {
  735. - $output .= comment_form(array('pid' => $pid, 'nid' => $nid), t('Reply'));
  736. + $output .= comment_form_box(array('pid' => $pid, 'nid' => $nid), t('Reply'));
  737. }
  738. else {
  739. drupal_set_message(t('You are not authorized to post comments.'), 'error');
  740. @@ -891,7 +891,7 @@ function comment_render($node, $cid = 0)
  741. // Start a form, for use with comment control.
  742. $result = pager_query($query, $comments_per_page, 0, $query_count, $query_args);
  743. if (db_num_rows($result) && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) {
  744. - $output .= comment_controls($mode, $order, $comments_per_page);
  745. + $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page);
  746. }
  747.  
  748. while ($comment = db_fetch_object($result)) {
  749. @@ -916,13 +916,13 @@ function comment_render($node, $cid = 0)
  750. $output .= theme('pager', NULL, $comments_per_page, 0);
  751.  
  752. if (db_num_rows($result) && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_BELOW || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) {
  753. - $output .= comment_controls($mode, $order, $comments_per_page);
  754. + $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page);
  755. }
  756. }
  757.  
  758. // If enabled, show new comment form.
  759. if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW)) {
  760. - $output .= comment_form(array('nid' => $nid), t('Post new comment'));
  761. + $output .= comment_form_box(array('nid' => $nid), t('Post new comment'));
  762. }
  763.  
  764. $output = theme('comment_wrapper', $output);
  765. @@ -956,13 +956,7 @@ function comment_delete($cid) {
  766. drupal_goto("node/$comment->nid");
  767. }
  768. else if (is_object($comment) && is_numeric($comment->cid)) {
  769. - $output = confirm_form('comment_confirm_delete',
  770. - array(),
  771. - t('Are you sure you want to delete the comment %title?', array('%title' => theme('placeholder', $comment->subject))),
  772. - 'node/'. $comment->nid,
  773. - t('Any replies to this comment will be lost. This action cannot be undone.'),
  774. - t('Delete'),
  775. - t('Cancel'));
  776. + $output = drupal_get_form('comment_confirm_delete', $subject, $nid);
  777. }
  778. else {
  779. drupal_set_message(t('The comment no longer exists.'));
  780. @@ -971,6 +965,16 @@ function comment_delete($cid) {
  781. return $output;
  782. }
  783.  
  784. +function comment_confirm_delete($subject, $nid) {
  785. + return confirm_form(
  786. + array(),
  787. + t('Are you sure you want to delete the comment %title?', array('%title' => theme('placeholder', $subject))),
  788. + 'node/'. $nid,
  789. + t('Any replies to this comment will be lost. This action cannot be undone.'),
  790. + t('Delete'),
  791. + t('Cancel'));
  792. +}
  793. +
  794. /**
  795. * Comment operations. We offer different update operations depending on
  796. * which comment administration page we're on.
  797. @@ -1014,7 +1018,7 @@ function comment_admin_overview($type =
  798. '#prefix' => '<div class="container-inline">', '#suffix' => '</div>'
  799. );
  800. $options = array();
  801. - foreach (comment_operations(arg(3) == 'approval' ? 'publish' : 'unpublish') as $key => $value) {
  802. + foreach (comment_operations(arg(4) == 'approval' ? 'publish' : 'unpublish') as $key => $value) {
  803. $options[$key] = $value[0];
  804. }
  805. $form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'publish');
  806. @@ -1043,7 +1047,7 @@ function comment_admin_overview($type =
  807. }
  808. $form['comments'] = array('#type' => 'checkboxes', '#options' => $comments);
  809. $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
  810. - return drupal_get_form('comment_admin_overview', $form);
  811. + return $form;
  812. }
  813.  
  814. /**
  815. @@ -1136,7 +1140,7 @@ function comment_multiple_delete_confirm
  816. drupal_goto('admin/content/comment');
  817. }
  818. else {
  819. - return confirm_form('comment_multiple_delete_confirm', $form,
  820. + return confirm_form($form,
  821. t('Are you sure you want to delete these comments and all their children?'),
  822. 'admin/content/comment', t('This action cannot be undone.'),
  823. t('Delete comments'), t('Cancel'));
  824. @@ -1421,8 +1425,11 @@ function comment_form($edit, $title = NU
  825.  
  826. // Graft in extra form additions
  827. $form = array_merge($form, comment_invoke_comment($form, 'form'));
  828. + return $form;
  829. +}
  830.  
  831. - return theme('box', $title, drupal_get_form('comment_form', $form));
  832. +function comment_form_box($edit, $title = NULL) {
  833. + return theme('box', $title, drupal_get_form('comment_form', $edit, $title));
  834. }
  835.  
  836. function comment_form_add_preview($form, $edit) {
  837. @@ -1575,7 +1582,7 @@ function comment_controls($mode = COMMEN
  838. '#weight' => 20,
  839. );
  840.  
  841. - return drupal_get_form('comment_controls', $form);
  842. + return $form;
  843. }
  844.  
  845. function theme_comment_controls($form) {
  846. @@ -1855,3 +1862,4 @@ function int2vancode($i = 0) {
  847. function vancode2int($c = '00') {
  848. return base_convert(substr($c, 1), 36, 10);
  849. }
  850. +
  851. === modified file 'modules/contact/contact.module'
  852. --- modules/contact/contact.module
  853. +++ modules/contact/contact.module
  854. @@ -90,7 +90,7 @@ function contact_menu($may_cache) {
  855. );
  856. $items[] = array('path' => 'contact',
  857. 'title' => t('contact'),
  858. - 'callback' => 'contact_mail_page',
  859. + 'callback' => 'contact_site_page',
  860. 'access' => user_access('access site-wide contact form'),
  861. 'type' => MENU_SUGGESTED_ITEM,
  862. );
  863. @@ -100,10 +100,9 @@ function contact_menu($may_cache) {
  864. global $user;
  865. $account = user_load(array('uid' => arg(1)));
  866. if (($user->uid != $account->uid && $account->contact) || user_access('administer users')) {
  867. - global $user;
  868. $items[] = array('path' => 'user/'. arg(1) .'/contact',
  869. 'title' => t('contact'),
  870. - 'callback' => 'contact_mail_user',
  871. + 'callback' => 'contact_user_page',
  872. 'type' => MENU_LOCAL_TASK,
  873. 'access' => ($user->uid && user_access('access personal contact forms')),
  874. 'weight' => 2,
  875. @@ -199,7 +198,7 @@ function contact_admin_edit($cid = NULL)
  876. '#value' => t('Submit'),
  877. );
  878.  
  879. - return drupal_get_form('contact_admin_edit', $form);
  880. + return $form;
  881. }
  882.  
  883. /**
  884. @@ -260,7 +259,7 @@ function contact_admin_delete($cid = NUL
  885. '#value' => $info->category,
  886. );
  887.  
  888. - return confirm_form('contact_admin_delete', $form, t('Are you sure you want to delete %category?', array('%category' => theme('placeholder', $info->category))), 'admin/build/contact', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
  889. + return confirm_form($form, t('Are you sure you want to delete %category?', array('%category' => theme('placeholder', $info->category))), 'admin/build/contact', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
  890. }
  891. else {
  892. drupal_set_message(t('Category not found.'), 'error');
  893. @@ -297,20 +296,13 @@ function contact_admin_settings() {
  894. '#default_value' => variable_get('contact_default_status', 1),
  895. '#description' => t('Default status of the personal contact form for new users.'),
  896. );
  897. - $form['submit'] = array('#type' => 'submit',
  898. - '#value' => t('Save configuration'),
  899. - );
  900. - $form['reset'] = array('#type' => 'submit',
  901. - '#value' => t('Reset to defaults'),
  902. - );
  903. -
  904. - return drupal_get_form('contact_admin_settings', $form, 'system_settings_form');
  905. + return system_settings_form($form);
  906. }
  907.  
  908. /**
  909. * Personal contact page.
  910. */
  911. -function contact_mail_user() {
  912. +function contact_user_page() {
  913. global $user;
  914.  
  915. if ($account = user_load(array('uid' => arg(1)))) {
  916. @@ -322,33 +314,7 @@ function contact_mail_user() {
  917. }
  918. else {
  919. drupal_set_title($account->name);
  920. -
  921. - $form['#token'] = $user->name . $user->mail;
  922. - $form['from'] = array('#type' => 'item',
  923. - '#title' => t('From'),
  924. - '#value' => $user->name .' &lt;'. $user->mail .'&gt;',
  925. - );
  926. - $form['to'] = array('#type' => 'item',
  927. - '#title' => t('To'),
  928. - '#value' => $account->name,
  929. - );
  930. - $form['subject'] = array('#type' => 'textfield',
  931. - '#title' => t('Subject'),
  932. - '#maxlength' => 50,
  933. - '#required' => TRUE,
  934. - );
  935. - $form['message'] = array('#type' => 'textarea',
  936. - '#title' => t('Message'),
  937. - '#rows' => 15,
  938. - '#required' => TRUE,
  939. - );
  940. - $form['copy'] = array('#type' => 'checkbox',
  941. - '#title' => t('Send me a copy.'),
  942. - );
  943. - $form['submit'] = array('#type' => 'submit',
  944. - '#value' => t('Send e-mail'),
  945. - );
  946. - $output = drupal_get_form('contact_mail_user', $form);
  947. + $output = drupal_get_form('contact_mail_user');
  948. }
  949.  
  950. return $output;
  951. @@ -358,6 +324,36 @@ function contact_mail_user() {
  952. }
  953. }
  954.  
  955. +function contact_mail_user() {
  956. + global $user;
  957. + $form['#token'] = $user->name . $user->mail;
  958. + $form['from'] = array('#type' => 'item',
  959. + '#title' => t('From'),
  960. + '#value' => $user->name .' &lt;'. $user->mail .'&gt;',
  961. + );
  962. + $form['to'] = array('#type' => 'item',
  963. + '#title' => t('To'),
  964. + '#value' => $account->name,
  965. + );
  966. + $form['subject'] = array('#type' => 'textfield',
  967. + '#title' => t('Subject'),
  968. + '#maxlength' => 50,
  969. + '#required' => TRUE,
  970. + );
  971. + $form['message'] = array('#type' => 'textarea',
  972. + '#title' => t('Message'),
  973. + '#rows' => 15,
  974. + '#required' => TRUE,
  975. + );
  976. + $form['copy'] = array('#type' => 'checkbox',
  977. + '#title' => t('Send me a copy.'),
  978. + );
  979. + $form['submit'] = array('#type' => 'submit',
  980. + '#value' => t('Send e-mail'),
  981. + );
  982. + return $form;
  983. +}
  984. +
  985. /**
  986. * Process the personal contact page form submission.
  987. */
  988. @@ -409,84 +405,85 @@ function contact_mail_user_submit($form_
  989. /**
  990. * Site-wide contact page
  991. */
  992. -function contact_mail_page() {
  993. +function contact_site_page() {
  994. global $user;
  995.  
  996. if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
  997. $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));
  998. }
  999. else {
  1000. - if ($user->uid) {
  1001. - $edit['name'] = $user->name;
  1002. - $edit['mail'] = $user->mail;
  1003. - }
  1004. + $output = drupal_get_form('contact_mail_page');
  1005. + }
  1006.  
  1007. - $result = db_query('SELECT cid, category, selected FROM {contact} ORDER BY weight, category');
  1008. - while ($category = db_fetch_object($result)) {
  1009. - $categories[$category->cid] = $category->category;
  1010. - if ($category->selected) {
  1011. - $default_category = $category->cid;
  1012. - }
  1013. - }
  1014. + return $output;
  1015. +}
  1016.  
  1017. - if (count($categories) > 0) {
  1018. - $form['#token'] = $user->name . $user->mail;
  1019. - $form['contact_information'] = array('#value' => filter_xss_admin(variable_get('contact_form_information', t('You can leave us a message using the contact form below.'))));
  1020. - $form['name'] = array('#type' => 'textfield',
  1021. - '#title' => t('Your name'),
  1022. - '#maxlength' => 255,
  1023. - '#default_value' => $edit['name'],
  1024. - '#required' => TRUE,
  1025. - );
  1026. - $form['mail'] = array('#type' => 'textfield',
  1027. - '#title' => t('Your e-mail address'),
  1028. - '#maxlength' => 255,
  1029. - '#default_value' => $edit['mail'],
  1030. - '#required' => TRUE,
  1031. - );
  1032. - $form['subject'] = array('#type' => 'textfield',
  1033. - '#title' => t('Subject'),
  1034. - '#maxlength' => 255,
  1035. - '#required' => TRUE,
  1036. - );
  1037. - if (count($categories) > 1) {
  1038. - // If there is more than one category available and no default category has been selected,
  1039. - // prepend a default placeholder value.
  1040. - if (!isset($default_category)) {
  1041. - $categories = array(t('--')) + $categories;
  1042. - }
  1043. - $form['cid'] = array('#type' => 'select',
  1044. - '#title' => t('Category'),
  1045. - '#default_value' => $default_category,
  1046. - '#options' => $categories,
  1047. - '#required' => TRUE,
  1048. - );
  1049. - }
  1050. - else {
  1051. - // If there is only one category, store its cid.
  1052. - $category_keys = array_keys($categories);
  1053. - $form['cid'] = array('#type' => 'value',
  1054. - '#value' => array_shift($category_keys),
  1055. - );
  1056. +function contact_mail_page() {
  1057. + global $user;
  1058. +
  1059. + $result = db_query('SELECT cid, category, selected FROM {contact} ORDER BY weight, category');
  1060. + while ($category = db_fetch_object($result)) {
  1061. + $categories[$category->cid] = $category->category;
  1062. + if ($category->selected) {
  1063. + $default_category = $category->cid;
  1064. + }
  1065. + }
  1066. +
  1067. + if (count($categories) > 0) {
  1068. + $form['#token'] = $user->name . $user->mail;
  1069. + $form['contact_information'] = array('#value' => filter_xss_admin(variable_get('contact_form_information', t('You can leave us a message using the contact form below.'))));
  1070. + $form['name'] = array('#type' => 'textfield',
  1071. + '#title' => t('Your name'),
  1072. + '#maxlength' => 255,
  1073. + '#default_value' => $user->uid ? $user->name : '',
  1074. + '#required' => TRUE,
  1075. + );
  1076. + $form['mail'] = array('#type' => 'textfield',
  1077. + '#title' => t('Your e-mail address'),
  1078. + '#maxlength' => 255,
  1079. + '#default_value' => $user->uid ? $user->mail : '',
  1080. + '#required' => TRUE,
  1081. + );
  1082. + $form['subject'] = array('#type' => 'textfield',
  1083. + '#title' => t('Subject'),
  1084. + '#maxlength' => 255,
  1085. + '#required' => TRUE,
  1086. + );
  1087. + if (count($categories) > 1) {
  1088. + // If there is more than one category available and no default category has been selected,
  1089. + // prepend a default placeholder value.
  1090. + if (!isset($default_category)) {
  1091. + $categories = array(t('--')) + $categories;
  1092. }
  1093. - $form['message'] = array('#type' => 'textarea',
  1094. - '#title' => t('Message'),
  1095. + $form['cid'] = array('#type' => 'select',
  1096. + '#title' => t('Category'),
  1097. + '#default_value' => $default_category,
  1098. + '#options' => $categories,
  1099. '#required' => TRUE,
  1100. );
  1101. - $form['copy'] = array('#type' => 'checkbox',
  1102. - '#title' => t('Send me a copy.'),
  1103. - );
  1104. - $form['submit'] = array('#type' => 'submit',
  1105. - '#value' => t('Send e-mail'),
  1106. - );
  1107. - $output = drupal_get_form('contact_mail_page', $form);
  1108. }
  1109. else {
  1110. - $output = t('The contact form has not been configured.');
  1111. + // If there is only one category, store its cid.
  1112. + $category_keys = array_keys($categories);
  1113. + $form['cid'] = array('#type' => 'value',
  1114. + '#value' => array_shift($category_keys),
  1115. + );
  1116. }
  1117. + $form['message'] = array('#type' => 'textarea',
  1118. + '#title' => t('Message'),
  1119. + '#required' => TRUE,
  1120. + );
  1121. + $form['copy'] = array('#type' => 'checkbox',
  1122. + '#title' => t('Send me a copy.'),
  1123. + );
  1124. + $form['submit'] = array('#type' => 'submit',
  1125. + '#value' => t('Send e-mail'),
  1126. + );
  1127. }
  1128. -
  1129. - return $output;
  1130. + else {
  1131. + $form['#error'] = array('#value' => t('The contact form has not been configured.'));
  1132. + }
  1133. + return $form;
  1134. }
  1135.  
  1136. /**
  1137. @@ -551,3 +548,4 @@ function contact_mail_page_submit($form_
  1138. // Jump to home page rather than back to contact page to avoid contradictory messages if flood control has been activated.
  1139. return('');
  1140. }
  1141. +
  1142. === modified file 'modules/drupal/drupal.module'
  1143. --- modules/drupal/drupal.module
  1144. +++ modules/drupal/drupal.module
  1145. @@ -111,7 +111,7 @@ function drupal_sites_registry_settings(
  1146. '#description' => t('If enabled, your Drupal site will allow other sites to register with your site and send information to this site. This functionality can be used to maintain a list of related sites.')
  1147. );
  1148.  
  1149. - return system_settings_form('drupal_sites_registry_settings', $form);
  1150. + return system_settings_form($form);
  1151. }
  1152.  
  1153. function drupal_distributed_authentication_settings() {
  1154. @@ -141,7 +141,7 @@ function drupal_distributed_authenticati
  1155. '#description' => t('Only accept remote logins from the above specified default authentication server and not from any other server. Useful when an external system is the solitary authority on user accounts for this site. A common usage is to enable this setting and also enable an authentication module which talks to your company\'s directory server.')
  1156. );
  1157.  
  1158. - return system_settings_form('drupal_distributed_authentication_settings', $form);
  1159. + return system_settings_form($form);
  1160. }
  1161.  
  1162. /**
  1163. === modified file 'modules/filter/filter.module'
  1164. --- modules/filter/filter.module
  1165. +++ modules/filter/filter.module
  1166. @@ -316,7 +316,7 @@ function filter_admin_overview() {
  1167. }
  1168. $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
  1169. $form['submit'] = array('#type' => 'submit', '#value' => t('Set default format'));
  1170. - return drupal_get_form('filter_admin_overview', $form);
  1171. + return $form;
  1172. }
  1173.  
  1174. function filter_admin_overview_submit($form_id, $form_values) {
  1175. @@ -359,7 +359,7 @@ function filter_admin_delete() {
  1176. $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
  1177. $form['name'] = array('#type' => 'hidden', '#value' => $format->name);
  1178.  
  1179. - return confirm_form('filter_admin_delete', $form, t('Are you sure you want to delete the input format %format?', array('%format' => theme('placeholder', $format->name))), 'admin/settings/filters', t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'), t('Delete'), t('Cancel'));
  1180. + return confirm_form($form, t('Are you sure you want to delete the input format %format?', array('%format' => theme('placeholder', $format->name))), 'admin/settings/filters', t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'), t('Delete'), t('Cancel'));
  1181. }
  1182. else {
  1183. drupal_set_message(t('The default format cannot be deleted.'));
  1184. @@ -440,8 +440,6 @@ function filter_admin_format_form($forma
  1185. '#description' => module_invoke($filter->module, 'filter', 'description', $filter->delta),
  1186. );
  1187. }
  1188. - $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
  1189. -
  1190. if (isset($format)) {
  1191. $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
  1192.  
  1193. @@ -454,11 +452,11 @@ function filter_admin_format_form($forma
  1194. }
  1195. $group = t('<p>These are the guidelines that users will see for posting in this input format. They are automatically generated from the filter settings.</p>');
  1196. $group .= $tiplist;
  1197. - $output = '<h2>'. t('Formatting guidelines') .'</h2>'. $group;
  1198. + $form['tips'] = array('#value' => '<h2>'. t('Formatting guidelines') .'</h2>'. $group);
  1199. }
  1200. - $output = drupal_get_form('filter_admin_format_form', $form) . $output;
  1201. + $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
  1202.  
  1203. - return $output;
  1204. + return $form;
  1205. }
  1206.  
  1207. /**
  1208. @@ -549,7 +547,7 @@ function filter_admin_order($format = NU
  1209. $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
  1210. $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
  1211.  
  1212. - return drupal_get_form('filter_admin_order', $form);
  1213. + return $form;
  1214. }
  1215.  
  1216. /**
  1217. @@ -600,13 +598,13 @@ function filter_admin_configure() {
  1218. }
  1219.  
  1220. if (!empty($form)) {
  1221. - $output = system_settings_form('filter_admin_configure', $form);
  1222. + $form = system_settings_form($form);
  1223. }
  1224. else {
  1225. - $output = t('No settings are available.');
  1226. + $form['error'] = array('#value' => t('No settings are available.'));
  1227. }
  1228.  
  1229. - return $output;
  1230. + return $form;
  1231. }
  1232.  
  1233. /**
  1234. === modified file 'modules/forum/forum.module'
  1235. --- modules/forum/forum.module
  1236. +++ modules/forum/forum.module
  1237. @@ -183,7 +183,6 @@ function forum_taxonomy($op, $type, $ter
  1238. }
  1239.  
  1240. function forum_admin_settings() {
  1241. -
  1242. $form = array();
  1243. $number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500));
  1244. $form['forum_hot_topic'] = array('#type' => 'select',
  1245. @@ -206,8 +205,7 @@ function forum_admin_settings() {
  1246. '#options' => $forder,
  1247. '#description' => t('The default display order for topics.'),
  1248. );
  1249. -
  1250. - return system_settings_form('forum_admin_configure', $form);
  1251. + return system_settings_form($form);
  1252. }
  1253.  
  1254. /**
  1255. @@ -445,7 +443,7 @@ function forum_delete(&$node) {
  1256. function forum_form_container($edit = array()) {
  1257. // Handle a delete operation.
  1258. if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
  1259. - return _forum_confirm_delete($edit['tid']);
  1260. + return forum_confirm_delete($edit['tid']);
  1261. }
  1262.  
  1263. $form['name'] = array(
  1264. @@ -481,8 +479,9 @@ function forum_form_container($edit = ar
  1265. $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
  1266. $form['tid'] = array('#type' => 'value', '#value' => $edit['tid']);
  1267. }
  1268. + $form['#function_prefix'] = 'forum_form';
  1269.  
  1270. - return drupal_get_form('forum_form_container', $form, 'forum_form');
  1271. + return $form;
  1272. }
  1273.  
  1274. /**
  1275. @@ -493,7 +492,7 @@ function forum_form_container($edit = ar
  1276. function forum_form_forum($edit = array()) {
  1277. // Handle a delete operation.
  1278. if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
  1279. - return _forum_confirm_delete($edit['tid']);
  1280. + return forum_confirm_delete($edit['tid']);
  1281. }
  1282.  
  1283. $form['name'] = array('#type' => 'textfield',
  1284. @@ -522,8 +521,9 @@ function forum_form_forum($edit = array(
  1285. $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
  1286. $form['tid'] = array('#type' => 'hidden', '#value' => $edit['tid']);
  1287. }
  1288. + $form['#function_prefix'] = 'forum_form';
  1289.  
  1290. - return drupal_get_form('forum_form_forum', $form, 'forum_form');
  1291. + return $form;
  1292. }
  1293.  
  1294. /**
  1295. @@ -561,13 +561,13 @@ function forum_form_submit($form_id, $fo
  1296. *
  1297. * @param $tid ID of the term to be deleted
  1298. */
  1299. -function _forum_confirm_delete($tid) {
  1300. +function forum_confirm_delete($tid) {
  1301. $term = taxonomy_get_term($tid);
  1302.  
  1303. $form['tid'] = array('#type' => 'value', '#value' => $tid);
  1304. $form['name'] = array('#type' => 'value', '#value' => $term->name);
  1305.  
  1306. - return confirm_form('forum_confirm_delete', $form, t('Are you sure you want to delete the forum %name?', array('%name' => theme('placeholder', $term->name))), 'admin/content/forums', t('Deleting a forum or container will delete all sub-forums and associated posts as well. This action cannot be undone.'), t('Delete'), t('Cancel'));
  1307. + return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => theme('placeholder', $term->name))), 'admin/content/forums', t('Deleting a forum or container will delete all sub-forums and associated posts as well. This action cannot be undone.'), t('Delete'), t('Cancel'));
  1308. }
  1309.  
  1310. /**
  1311. === modified file 'modules/locale/locale.module'
  1312. --- modules/locale/locale.module
  1313. +++ modules/locale/locale.module
  1314. @@ -338,7 +338,7 @@ function locale_admin_manage_delete_form
  1315. }
  1316. else {
  1317. $form['langcode'] = array('#type' => 'value', '#value' => $langcode);
  1318. - return confirm_form('locale_admin_manage_delete_form', $form, t('Are you sure you want to delete the language %name?', array('%name' => theme('placeholder', t($languages['name'][$langcode])))), 'admin/settings/locale/language/overview', t('Deleting a language will remove all data associated with it. This action cannot be undone.'), t('Delete'), t('Cancel'));
  1319. + return confirm_form($form, t('Are you sure you want to delete the language %name?', array('%name' => theme('placeholder', t($languages['name'][$langcode])))), 'admin/settings/locale/language/overview', t('Deleting a language will remove all data associated with it. This action cannot be undone.'), t('Delete'), t('Cancel'));
  1320. }
  1321. }
  1322.  
  1323. === modified file 'modules/menu/menu.module'
  1324. --- modules/menu/menu.module
  1325. +++ modules/menu/menu.module
  1326. @@ -308,7 +308,7 @@ function menu_configure() {
  1327. '#description' => t('Choose the menu to be made available in the content authoring form. Only this menu item and its children will be shown.'),
  1328. );
  1329.  
  1330. - return system_settings_form('menu_configure', $form);
  1331. + return system_settings_form($form);
  1332. }
  1333.  
  1334. /**
  1335. @@ -336,9 +336,10 @@ function menu_edit_menu_form($type, $mid
  1336. $form['weight'] = array('#type' => 'value', '#value' => $item['weight']);
  1337. $form['type'] = array('#type' => 'value', '#value' => $item['type']);
  1338. $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
  1339. -
  1340. // Reuse the submit function of menu_edit_item_form.
  1341. - return drupal_get_form('menu_edit_menu_form', $form, 'menu_edit_item_form');
  1342. + $form['#function_prefix'] = 'menu_edit_item_form';
  1343. +
  1344. + return $form;
  1345. }
  1346.  
  1347. /**
  1348. @@ -416,7 +417,7 @@ function menu_edit_item_form($type, $mid
  1349. $form['mid'] = array('#type' => 'value', '#value' => $item['mid']);
  1350. $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
  1351.  
  1352. - return drupal_get_form('menu_edit_item_form', $form);
  1353. + return $form;
  1354. }
  1355.  
  1356. /**
  1357. @@ -447,13 +448,13 @@ function menu_item_delete_form($mid) {
  1358. $message = t('Are you sure you want to delete the custom menu item %item?', array('%item' => theme('placeholder', $menu->title)));
  1359. }
  1360.  
  1361. - return confirm_form('menu_confirm_delete_form', $form, $message, 'admin/build/menu', t('This action cannot be undone.'), t('Delete'));
  1362. + return confirm_form($form, $message, 'admin/build/menu', t('This action cannot be undone.'), t('Delete'));
  1363. }
  1364.  
  1365. /**
  1366. * Process menu delete form submissions.
  1367. */
  1368. -function menu_confirm_delete_form_submit($form_id, $form_values) {
  1369. +function menu_item_delete_form_submit($form_id, $form_values) {
  1370. menu_delete_item($form_values['mid']);
  1371.  
  1372. $t_args = array('%title' => theme('placeholder', $form_values['title']));
  1373. @@ -475,7 +476,7 @@ function menu_confirm_delete_form_submit
  1374. function menu_reset_item($mid) {
  1375. if (isset($mid) && $title = db_result(db_query('SELECT title FROM {menu} WHERE mid = %d', $mid))) {
  1376. $form['mid'] = array('#type' => 'value', '#value' => $mid);
  1377. - return confirm_form('menu_reset_item_form', $form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => theme('placeholder', $title))), 'admin/build/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
  1378. + return confirm_form($form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => theme('placeholder', $title))), 'admin/build/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
  1379. }
  1380. else {
  1381. drupal_not_found();
  1382. @@ -485,7 +486,7 @@ function menu_reset_item($mid) {
  1383. /**
  1384. * Process menu reset item form submissions.
  1385. */
  1386. -function menu_reset_item_form_submit($form_id, $form_values) {
  1387. +function menu_reset_item_submit($form_id, $form_values) {
  1388. menu_delete_item($form_values['mid']);
  1389. drupal_set_message(t('The menu item was reset to its default settings.'));
  1390.  
  1391. === modified file 'modules/node/content_types.inc'
  1392. --- modules/node/content_types.inc
  1393. +++ modules/node/content_types.inc
  1394. @@ -207,7 +207,7 @@ function node_type_form($type = NULL) {
  1395. );
  1396. }
  1397.  
  1398. - return drupal_get_form('node_type_form', $form);
  1399. + return $form;
  1400. }
  1401.  
  1402. /**
  1403. === modified file 'modules/node/node.module'
  1404. --- modules/node/node.module
  1405. +++ modules/node/node.module
  1406. @@ -948,7 +948,7 @@ function node_configure() {
  1407. '#options' => array(t('Optional'), t('Required')), '#description' => t('Must users preview posts before submitting?')
  1408. );
  1409.  
  1410. - return system_settings_form('node_configure', $form);
  1411. + return system_settings_form($form);
  1412. }
  1413.  
  1414. /**
  1415. @@ -1004,7 +1004,7 @@ function node_menu($may_cache) {
  1416. 'path' => 'admin/content/node',
  1417. 'title' => t('posts'),
  1418. 'description' => t('View, edit, and delete your site\'s content.'),
  1419. - 'callback' => 'node_admin_nodes',
  1420. + 'callback' => 'node_admin_content',
  1421. 'access' => user_access('administer nodes')
  1422. );
  1423.  
  1424. @@ -1143,7 +1143,7 @@ function node_menu($may_cache) {
  1425. // There is no need to rebuild node_access if there is only 1 record in the table (the default configuration).
  1426. if (db_result(db_query('SELECT COUNT(*) FROM {node_access}')) > 1) {
  1427. $items[] = array('path' => 'admin/settings/node-access', 'title' => t('node access'),
  1428. - 'callback' => 'node_access_rebuild_page',
  1429. + 'callback' => 'node_access_rebuild',
  1430. 'access' => user_access('administer nodes'));
  1431. }
  1432. }
  1433. @@ -1312,13 +1312,13 @@ function node_filter_form() {
  1434. $form['filters']['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset'));
  1435. }
  1436.  
  1437. - return drupal_get_form('node_filter_form', $form);
  1438. + return $form;
  1439. }
  1440.  
  1441. /**
  1442. * Theme node administration filter form.
  1443. */
  1444. -function theme_node_filter_form(&$form) {
  1445. +function theme_node_filter_form($form) {
  1446. $output .= '<div id="node-admin-filter">';
  1447. $output .= drupal_render($form['filters']);
  1448. $output .= '</div>';
  1449. @@ -1329,7 +1329,7 @@ function theme_node_filter_form(&$form)
  1450. /**
  1451. * Theme node administraton filter selector.
  1452. */
  1453. -function theme_node_filters(&$form) {
  1454. +function theme_node_filters($form) {
  1455. $output .= '<ul>';
  1456. if (sizeof($form['current'])) {
  1457. foreach (element_children($form['current']) as $key) {
  1458. @@ -1420,14 +1420,20 @@ function node_admin_nodes_validate($form
  1459. /**
  1460. * Menu callback: content administration.
  1461. */
  1462. -function node_admin_nodes() {
  1463. - global $form_values;
  1464. - $output = node_filter_form();
  1465. +function node_admin_content() {
  1466. + $output = drupal_get_form('node_filter_form');
  1467.  
  1468. if ($_POST['edit']['operation'] == 'delete' && $_POST['edit']['nodes']) {
  1469. return node_multiple_delete_confirm();
  1470. }
  1471. + // Call the form first, to allow for the form_values array to be populated.
  1472. + $output .= drupal_get_form('node_admin_nodes');
  1473. +
  1474. + return $output;
  1475. +}
  1476.  
  1477. +function node_admin_nodes() {
  1478. + global $form_values;
  1479. $filter = node_build_filter_query();
  1480.  
  1481. $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']);
  1482. @@ -1455,11 +1461,7 @@ function node_admin_nodes() {
  1483. }
  1484. $form['nodes'] = array('#type' => 'checkboxes', '#options' => $nodes);
  1485. $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
  1486. -
  1487. - // Call the form first, to allow for the form_values array to be populated.
  1488. - $output .= drupal_get_form('node_admin_nodes', $form);
  1489. -
  1490. - return $output;
  1491. + return $form;
  1492. }
  1493.  
  1494. /**
  1495. @@ -1508,7 +1510,7 @@ function node_multiple_delete_confirm()
  1496. }
  1497. $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
  1498.  
  1499. - return confirm_form('node_multiple_delete_confirm', $form,
  1500. + return confirm_form($form,
  1501. t('Are you sure you want to delete these items?'),
  1502. 'admin/content/node', t('This action cannot be undone.'),
  1503. t('Delete all'), t('Cancel'));
  1504. @@ -1851,18 +1853,10 @@ function node_object_prepare(&$node) {
  1505. }
  1506.  
  1507. /**
  1508. - * Generate the node editing form.
  1509. + * Generate the node editing form array
  1510. */
  1511. function node_form($node) {
  1512. $node = (object)$node;
  1513. - $form = node_form_array($node);
  1514. - return drupal_get_form($node->type .'_node_form', $form, 'node_form');
  1515. -}
  1516. -
  1517. -/**
  1518. - * Generate the node editing form array.
  1519. - */
  1520. -function node_form_array($node) {
  1521. node_object_prepare($node);
  1522.  
  1523. // Set the id of the top-level form tag
  1524. @@ -1930,9 +1924,8 @@ function node_form_array($node) {
  1525. if ($node->nid && node_access('delete', $node)) {
  1526. $form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 50);
  1527. }
  1528. -
  1529. $form['#after_build'] = array('node_form_add_preview');
  1530. -
  1531. + $form['#function_prefix'] = 'node_form';
  1532. return $form;
  1533. }
  1534.  
  1535. @@ -2007,7 +2000,7 @@ function node_add($type = NULL) {
  1536. // Initialize settings:
  1537. $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type);
  1538.  
  1539. - $output = node_form($node);
  1540. + $output = drupal_get_form($type .'_node_form', $node);
  1541. drupal_set_title(t('Submit %name', array('%name' => check_plain($types[$type]->name))));
  1542. }
  1543. else {
  1544. @@ -2155,7 +2148,7 @@ function node_delete_confirm() {
  1545.  
  1546. if (node_access('delete', $node)) {
  1547. $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
  1548. - $output = confirm_form('node_delete_confirm', $form,
  1549. + $output = confirm_form($form,
  1550. t('Are you sure you want to delete %title?', array('%title' => theme('placeholder', $node->title))),
  1551. $_GET['destination'] ? $_GET['destination'] : 'node/'. $node->nid, t('This action cannot be undone.'),
  1552. t('Delete'), t('Cancel') );
  1553. @@ -2316,7 +2309,7 @@ function node_page_edit($node) {
  1554. }
  1555.  
  1556. drupal_set_title(check_plain($node->title));
  1557. - return node_form($node);
  1558. + return drupal_get_form($node->type . '_node_form', $node);
  1559. }
  1560.  
  1561. /**
  1562. @@ -2790,7 +2783,7 @@ function node_access_write_grants($node,
  1563. }
  1564. }
  1565.  
  1566. -function node_access_rebuild_page() {
  1567. +function node_access_rebuild() {
  1568. $form['markup'] = array(
  1569. '#prefix' => '<p>',
  1570. '#value' => t('Rebuilding the node_access table is necessary immediately after uninstalling a module that utilizes the node_access system. Each node will have its access control recalculated. This may take a while if your site has many nodes.'),
  1571. @@ -2800,18 +2793,18 @@ function node_access_rebuild_page() {
  1572. '#type' => 'submit',
  1573. '#value' => t('Rebuild node access'),
  1574. );
  1575. - return drupal_get_form('node_access_rebuild', $form);
  1576. + return $form;
  1577. }
  1578.  
  1579. /**
  1580. * rebuild the node access database
  1581. */
  1582. function node_access_rebuild_submit() {
  1583. - node_access_rebuild();
  1584. + _node_access_rebuild();
  1585. drupal_set_message(t('The node access table has been rebuilt.'));
  1586. }
  1587.  
  1588. -function node_access_rebuild() {
  1589. +function _node_access_rebuild() {
  1590. db_query("DELETE FROM {node_access}");
  1591. // only recalculate if site is using a node_access module
  1592. if (count(module_implements('node_grants'))) {
  1593. @@ -2890,3 +2883,12 @@ function node_content_form($node) {
  1594. * @} End of "defgroup node_content".
  1595. */
  1596.  
  1597. +/**
  1598. + * Implementation of hook_forms(). All node forms share the same form handler
  1599. + */
  1600. +function node_forms() {
  1601. + foreach (array_keys(node_get_types()) as $type) {
  1602. + $forms[$type .'_node_form']['callback'] = 'node_form';
  1603. + }
  1604. + return $forms;
  1605. +}
  1606. === modified file 'modules/path/path.module'
  1607. --- modules/path/path.module
  1608. +++ modules/path/path.module
  1609. @@ -103,7 +103,7 @@ function path_admin_delete_confirm($pid)
  1610. $path = path_load($pid);
  1611. if (user_access('administer url aliases')) {
  1612. $form['pid'] = array('#type' => 'value', '#value' => $pid);
  1613. - $output = confirm_form('path_admin_delete_confirm', $form,
  1614. + $output = confirm_form($form,
  1615. t('Are you sure you want to delete path alias %title?', array('%title' => theme('placeholder', $path['dst']))),
  1616. $_GET['destination'] ? $_GET['destination'] : 'admin/build/path', t('This action cannot be undone.'),
  1617. t('Delete'), t('Cancel') );
  1618. @@ -193,7 +193,7 @@ function path_form($edit = '') {
  1619. $form['submit'] = array('#type' => 'submit', '#value' => t('Create new alias'));
  1620. }
  1621.  
  1622. - return drupal_get_form('path_form', $form);
  1623. + return $form;
  1624. }
  1625.  
  1626. /**
  1627. === modified file 'modules/poll/poll.module'
  1628. --- modules/poll/poll.module
  1629. +++ modules/poll/poll.module
  1630. @@ -321,11 +321,7 @@ function poll_teaser($node) {
  1631. /**
  1632. * Generates the voting form for a poll.
  1633. */
  1634. -function poll_view_voting(&$node, $teaser, $page, $block) {
  1635. - if ($_POST['op'] == t('Vote')) {
  1636. - poll_vote($node);
  1637. - }
  1638. -
  1639. +function poll_view_voting($node, $page) {
  1640. if ($node->choice) {
  1641. $list = array();
  1642. foreach ($node->choice as $i => $choice) {
  1643. @@ -336,7 +332,7 @@ function poll_view_voting(&$node, $tease
  1644. $form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
  1645. $form['vote'] = array('#type' => 'submit', '#value' => t('Vote'));
  1646. $form['#action'] = url('node/'. $

Report this snippet  

You need to login to post a comment.