|
From: Meik S. <acy...@us...> - 2005-08-18 23:29:55
|
Update of /cvsroot/phpbb/phpBB2/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24644/includes Modified Files: functions.php Log Message: - added function for easily building hidden fields - extended confirm_box function (ability to use custom urls, ability to use custom confirm message) Index: functions.php =================================================================== RCS file: /cvsroot/phpbb/phpBB2/includes/functions.php,v retrieving revision 1.321 retrieving revision 1.322 diff -C2 -r1.321 -r1.322 *** functions.php 13 Jun 2005 17:51:44 -0000 1.321 --- functions.php 18 Aug 2005 12:48:39 -0000 1.322 *************** *** 1226,1233 **** * Build Confirm box */ ! function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html') { global $user, $template, $db; ! global $SID, $phpEx; if (isset($_POST['cancel'])) --- 1226,1233 ---- * Build Confirm box */ ! function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '') { global $user, $template, $db; ! global $SID, $phpEx, $phpbb_root_path; if (isset($_POST['cancel'])) *************** *** 1269,1278 **** } ! $s_hidden_fields = '<input type="hidden" name="user_id" value="' . $user->data['user_id'] . '" /><input type="hidden" name="sess" value="' . $user->session_id . '" /><input type="hidden" name="sid" value="' . $SID . '" />'; // generate activation key $confirm_key = gen_rand_string(10); ! page_header($user->lang[$title]); $template->set_filenames(array( --- 1269,1280 ---- } ! $s_hidden_fields = '<input type="hidden" name="user_id" value="' . $user->data['user_id'] . '" />'; ! $s_hidden_fields .= '<input type="hidden" name="sess" value="' . $user->session_id . '" />'; ! $s_hidden_fields .= '<input type="hidden" name="sid" value="' . $SID . '" />'; // generate activation key $confirm_key = gen_rand_string(10); ! page_header((!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title]); $template->set_filenames(array( *************** *** 1288,1297 **** // re-add $SID ! $u_action = (strpos($user->page, ".{$phpEx}?") !== false) ? str_replace(".{$phpEx}?", ".$phpEx$SID&", $user->page) . '&' : $user->page . '?'; $u_action .= 'confirm_key=' . $confirm_key; $template->assign_vars(array( ! 'MESSAGE_TITLE' => $user->lang[$title], ! 'MESSAGE_TEXT' => $user->lang[$title . '_CONFIRM'], 'YES_VALUE' => $user->lang['YES'], --- 1290,1300 ---- // re-add $SID ! $use_page = ($u_action) ? $phpbb_root_path . $u_action : $phpbb_root_path . $user->page; ! $u_action = (strpos($use_page, ".{$phpEx}?") !== false) ? str_replace(".{$phpEx}?", ".$phpEx$SID&", $use_page) . '&' : $use_page . '?'; $u_action .= 'confirm_key=' . $confirm_key; $template->assign_vars(array( ! 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title], ! 'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'], 'YES_VALUE' => $user->lang['YES'], *************** *** 1601,1604 **** --- 1604,1632 ---- /** + * Build simple hidden fields from array + */ + function build_hidden_fields($field_ary) + { + $s_hidden_fields = ''; + + foreach ($field_ary as $name => $vars) + { + if (is_array($vars)) + { + foreach ($vars as $key => $value) + { + $s_hidden_fields .= '<input type="hidden" name="' . $name . '[' . $key . ']" value="' . $value . '" />'; + } + } + else + { + $s_hidden_fields .= '<input type="hidden" name="' . $name . '" value="' . $vars . '" />'; + } + } + + return $s_hidden_fields; + } + + /** * Error and message handler, call with trigger_error if reqd */ *************** *** 1945,1950 **** 'U_JS_POPUP_PM' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=popup", 'U_MEMBERLIST' => "{$phpbb_root_path}memberlist.$phpEx$SID", - 'U_VIEWONLINE' => "{$phpbb_root_path}viewonline.$phpEx$SID", 'U_MEMBERSLIST' => "{$phpbb_root_path}memberlist.$phpEx$SID", 'U_LOGIN_LOGOUT' => $u_login_logout, 'U_INDEX' => "{$phpbb_root_path}index.$phpEx$SID", --- 1973,1978 ---- 'U_JS_POPUP_PM' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=popup", 'U_MEMBERLIST' => "{$phpbb_root_path}memberlist.$phpEx$SID", 'U_MEMBERSLIST' => "{$phpbb_root_path}memberlist.$phpEx$SID", + 'U_VIEWONLINE' => "{$phpbb_root_path}viewonline.$phpEx$SID", 'U_LOGIN_LOGOUT' => $u_login_logout, 'U_INDEX' => "{$phpbb_root_path}index.$phpEx$SID", *************** *** 1959,1962 **** --- 1987,1991 ---- 'U_SEARCH_ACTIVE_TOPICS'=> "{$phpbb_root_path}search.$phpEx$SID&search_id=active_topics", 'U_DELETE_COOKIES' => "{$phpbb_root_path}ucp.$phpEx$SID&mode=delete_cookies", + 'U_TEAM' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=leaders", 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false, |