/** * Prints a closing table tag and closes the form tag if it is open * * @param integer Column span of the optional table row to be printed * @param string If specified, creates an additional table row with this code as its contents * @param string Tooltip for optional table row * @param boolean Whether or not to close the <form> tag */ function print_table_footer($colspan = 2, $rowhtml = '', $tooltip = '', $echoform = true) { global $tableadded, $vbulletin; if ($rowhtml) { $tooltip = iif($tooltip != '', " title=\"{$tooltip}\"", ''); if ($tableadded) { echo "<tr>\n\t<td class=\"tfoot\"" . iif($colspan != 1, " colspan=\"{$colspan}\"") . " align=\"center\"{$tooltip}>{$rowhtml}</td>\n</tr>\n"; } else { echo "<p align=\"center\"{$tooltip}>{$extra}</p>\n"; } } if ($tableadded) { echo "</table>\n"; } if ($echoform) { print_hidden_fields(); echo "</form>\n<!-- form ended: " . $vbulletin->db->querycount . " queries executed -->\n\n"; } }
private function printForm() { $_SESSION['enter_attendance_token'] = md5(time()); // STEP 2 - enter attendances ob_start(); ?> <form method="post" class="attendance warn-unsaved" action="?view=attendance__record"> <input type="hidden" name="attendance_date" value="<?php echo $this->_attendance_date; ?> " /> <input type="hidden" name="show_photos" value="<?php echo $this->_show_photos; ?> " /> <input type="hidden" name="parallel_mode" value="<?php echo $this->_parallel_mode; ?> " /> <input type="hidden" name="enter_attendance_token" value="<?php echo $_SESSION['enter_attendance_token']; ?> " /> <input type="hidden" name="attendances_submitted" value="1" /> <?php print_hidden_fields(array('cohortids' => $this->_cohortids, 'age_brackets' => $this->_age_brackets, 'statuses' => $this->_statuses)); ?> <p class="visible-desktop smallprint">For greatest speed, press P for present and A for absent. The cursor will automatically progress to the next person. To go back, use the arrow keys.</p> <?php if ($this->_parallel_mode && count($this->_cohortids) > 1 && !SizeDetector::isNarrow()) { $totalPrinted = $this->printFormParallel(); } else { $totalPrinted = $this->printFormSequential(); } ?> </form> <?php if (ini_get('max_input_vars') && $totalPrinted > ini_get('max_input_vars')) { ob_end_clean(); print_message(_("The parameters you have selected will list more persons ") . _("than your server can process. Please narrow down your parameters, ") . _("or ask your server administrator to increase the PHP max_input_vars setting") . _(" (currently ") . ini_get('max_input_vars') . ')', 'error'); } else { ob_flush(); } }
function print_hidden_fields($arr, $prefix = '', $suffix = '') { foreach ($arr as $id => $val) { if (is_array($val)) { print_hidden_fields($val, $id . '[', ']'); } else { echo '<input type="hidden" name="' . ents($prefix . $id . $suffix) . '" value="' . ents($val) . '" />' . "\n"; } } }
function printSimilarFamilies() { $msg = count($this->_similar_families) > 1 ? 'Several families already exist that are similar to the one you are creating' : 'A family similar to the one you are creating already exists'; ?> <p class="alert alert-error"><b>Warning: <?php echo $msg; ?> .</b></p> <?php foreach ($this->_similar_families as $family) { ?> <h4><a href="<?php echo build_url(array('view' => 'families', 'familyid' => $family->id)); ?> ">Family #<?php echo $family->id; ?> </a></h4> <?php $family->printSummary(); } ?> <form method="post" class="min"> <?php print_hidden_fields($_POST); ?> <input type="submit" class="btn" name="override_dup_check" value="Create new family anyway" /> </form> <form method="get" class="min"> <input type="submit" class="btn" value="Cancel family creation" /> </form> <?php }
private function launchPopupFromHiddenIframe($blanks) { ?> <html> <body> <form id="emailpopupform" method="post" action="<?php echo build_url(array('print_popup' => 1)); ?> " target="emailpopup"> <?php print_hidden_fields($_POST); ?> </form> <script> var w = <?php echo empty($blanks) ? '300' : 'Math.round(screen.width * 0.6, 10)'; ?> ; var h = <?php echo empty($blanks) ? '300' : '450'; ?> ; var left = Math.round(screen.width - w); var top = Math.round((screen.height/2)-(h/2), 10); medLinkPopupWindow = window.open('', 'emailpopup', 'height='+h+',width='+w+',top='+top+',left='+left+',resizable=yes,scrollbars=yes'); if (medLinkPopupWindow && (medLinkPopupWindow.outerHeight)) { document.getElementById('emailpopupform').submit(); try { medLinkPopupWindow.focus(); } catch (e) {} } else { alert('Jethro tried but could not open a popup window - you probably have a popup blocker enabled. Please disable your popup blocker for this site, reload the page and try again.'); } </script> </body> </html> <?php }
function doUpload($sessionid) { global $vbphrase, $vbulletin; global $_HIDDENFIELDS; //first let's make sure we have a valid session and valid list if (!$sessionid) { return; } $vbulletin->input->clean_array_gpc('r', array('listid' => TYPE_UINT, 'do_percycle' => TYPE_UINT, 'startat' => TYPE_UINT, 'count' => TYPE_UINT, 'condition' => TYPE_STR)); $client = new vB_VerticalResponse(); if (!$vbulletin->GPC_exists['do_percycle'] or !intval($vbulletin->GPC['do_percycle'])) { $vbulletin->GPC['do_percycle'] = 1000; } else { $vbulletin->GPC['do_percycle'] = min(40000, $vbulletin->GPC['do_percycle']); } if (!$client->checkStatus($sessionid)) { printLogin($vbphrase['vr_login_first_desc']); return; } if ($vbulletin->GPC_exists['listid'] and $vbulletin->GPC_exists['condition']) { $listid = $vbulletin->GPC['listid']; if (intval($vbulletin->GPC['startat']) == 0) { $client->setCustomListFields($sessionid, array('userid', 'username')); //if we're just starting, clear the existing records $client->eraseListMembers($sessionid, $listid); } } else { return false; } //we appear to have good data. Let's see how many records this will return $condition = $vbulletin->GPC['condition']; $searchquery = "\n\t\tSELECT\n\t\tuser.userid, user.username, user.email AS email_address\n\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\tLEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (userfield.userid = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\n\t\tWHERE {$condition}\n\t\tORDER BY userid LIMIT " . intval($vbulletin->GPC['startat']) . ", " . $vbulletin->GPC['do_percycle']; $users = $vbulletin->db->query_read($searchquery); $members = ''; //we've got the info, let's query and build the resultset if ($users) { while ($user = $vbulletin->db->fetch_array($users)) { $members .= $user['userid'] . ',"' . str_replace('"', '""', trim($user['username'])) . '","' . str_replace('"', '""', trim($user['email_address'])) . "\"\n"; } } print_cp_header($vbphrase['verticalresponse']); if (empty($members)) { //We're done. echo $vbphrase['vr_upload_complete']; return; } else { $client->addListMembers($sessionid, $listid, $members, array('userid', 'username', 'email_address')); } print_form_header('verticalresponse', 'do_upload', false, true, 'verticalresponse'); print_table_header($vbphrase['upload_list'], 2); $_HIDDENFIELDS['condition'] = htmlspecialchars_uni($condition); $_HIDDENFIELDS['do_percycle'] = $vbulletin->GPC['do_percycle']; $_HIDDENFIELDS['startat'] = intval($vbulletin->GPC['startat']) + intval($vbulletin->GPC['do_percycle']); $_HIDDENFIELDS['count'] = $vbulletin->GPC['count']; $_HIDDENFIELDS['listid'] = $listid; print_hidden_fields(); //let's make a nice display: if ($vbulletin->GPC_exists['count'] and intval($vbulletin->GPC['count']) > 0) { $last = min(intval($vbulletin->GPC['startat']) + intval($vbulletin->GPC['do_percycle']), $vbulletin->GPC['count']); $width = intval(400 * intval($vbulletin->GPC['startat']) / intval($vbulletin->GPC['count'])); } else { echo "fred 2<br />\n"; $last = intval($vbulletin->GPC['startat']) + intval($vbulletin->GPC['do_percycle']); $width = 0; } $status = construct_phrase($vbphrase['uploading_user_x_to_y_of_z'], $vbulletin->GPC['startat'], $last, $vbulletin->GPC['count']); $display = "<div style=\"width:400px;height:25px;border:2px solid;text-align:" . vB_Template_Runtime::fetchStyleVar('left') . ";float:" . vB_Template_Runtime::fetchStyleVar('left') . ";\" class=\"textarea\"><div class=\"button\" style=\"width:" . $width . "px;height:25px;float:" . vB_Template_Runtime::fetchStyleVar('left') . "\"></div></div>"; print_cells_row(array($status, $display)); print_submit_row($vbphrase['next_page'], 0); print_form_auto_submit('verticalresponse'); print_table_footer(); }
public static function listSections($page, $per_page = 10) { global $vbphrase; global $vbulletin; require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('cpcms'); $sectionid = ( ($vbulletin->GPC_exists['sectionid'] AND intval($vbulletin->GPC['sectionid']))? $vbulletin->GPC['sectionid'] : false); $sections = self::getSection($sectionid); if ($record_count = count($sections)) { $sections = array_slice($sections, ($page-1) * $per_page, $per_page, true); $parent = $vbulletin->db->query_first($sql = "SELECT info.title FROM " . TABLE_PREFIX . "cms_node AS node INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid WHERE " . ( $sectionid ? " node.nodeid = " . $sectionid : " node.nodeid IS NULL" )); $i = 1; $result = print_form_header('cms_content_admin', '', false, true, 'cms_data', '100%', '_self', true, 'post', 0, false); $result .= "<input type=\"hidden\" id=\"sectionid\" value=\"" . ( $sectionid ? $sectionid :'') . "\" name=\"sectionid\"/> <input type=\"hidden\" name=\"sentfrom\" id=\"section\" value=\"section\"/> <input type=\"hidden\" name=\"id\" id=\"id\" value=\"0\"/>"; $result .= self::getSectionHeaders($sectionid) . "<br />\n"; $result .= "<tr class=\"tcat\"> <td class=\"feature_management_header\" style=\"padding:5px;float:" . vB_Template_Runtime::fetchStyleVar('left') . ";\"><div style=\"float:" . vB_Template_Runtime::fetchStyleVar('left') . "\"> " . $vbphrase['you_are_managing'] . " " . $vbphrase['section'] . ": <span class=\"section_name\">" . $parent['title'] . ($vbulletin->GPC_exists['sectionid'] ? '' : '(' . $vbphrase['all_sections'] .')') . "</span> <input type=\"button\" onclick=\"showNodeWindow('filter_section')\" value=\"" . $vbphrase['navigate_to_section'] ."\"> " . " </div> </td> </tr>"; $result.= "<tr><td>\n"; $result .= "<div style=\"overflow:auto;margin: auto;\"> <table class=\"tborder\" cellpadding=\"4\" border=\"0\" width=\"100%\" align=\"center\">\n"; $bgclass = fetch_row_bgclass(); $result .= "<tr align=\"center\" class=\"thead\">\n"; $result .= "<td class=\"thead\" width=\"20\">#</td> <td class=\"thead\" align=\"" . vB_Template_Runtime::fetchStyleVar('left') . "\" width=\"400\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=config4.value\" target=\"_self\">" . $vbphrase['title'] . "</a></td> <td class=\"thead\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=setpublish\">" . $vbphrase['published'] . "</a></td> <td class=\"thead\">" . $vbphrase['content_layout'] . "</td> <td class=\"thead\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=auto_displayorder\" target=\"_self\">" . $vbphrase['display_order'] . "</a></td> <td class=\"thead\" width=\"50\">" . $vbphrase['records_per_page'] . "</td> <td class=\"thead\">" . $vbphrase['subsections'] . "</td> <td class=\"thead\">" . $vbphrase['content'] . "</td> <td class=\"thead\">" . $vbphrase['viewcount'] . "</td>". /* <td class=\"thead\">" . $vbphrase['layout'] . "</td> <td class=\"thead\">" . $vbphrase['style'] . "</td> */ " </tr>"; $sequence = 0; foreach($sections as $key => $section) { $sequence++; $first_selected_parent_row_class = ""; $change_display_order_buttons = ""; $section_name_prefix = ((vB_Template_Runtime::fetchStyleVar('textdirection') == 'ltr') ? '>' : '>'); if ($sequence == 1 AND $page == 1) { $first_selected_parent_row_class = " class=\"selected_parent_row\""; $section_name_prefix = ""; } // for sub-sections, display up or down arrows to change the display order else { $change_display_order_buttons = "<div style=\"float:" . vB_Template_Runtime::fetchStyleVar('left') . "; width:32px;\">"; // dont display up arrow if its already first section in list if ($sequence > 2 AND isset($sections[$key-1])) { $change_display_order_buttons .= "<a style=\"float:" . vB_Template_Runtime::fetchStyleVar('left') . ";\" href=\"javascript:swapSections(".$section['nodeid'].", ".$sections[$key-1]['nodeid'].")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/arrow_up.png\" style=\"border-style:none\" /></a>"; } // dont display down arrow is its already last section in list if ($sequence < count($sections) AND isset($sections[$key+1])) { $change_display_order_buttons .= "<a style=\"float:right;\" href=\"javascript:swapSections(".$section['nodeid'].", ".$sections[$key+1]['nodeid'].")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/arrow_down.png\" style=\"border-style:none\" /></a>"; } $change_display_order_buttons .= "</div>"; } $bgclass = fetch_row_bgclass(); $result .= "<tr" . $first_selected_parent_row_class . " align=\"center\">\n <input type=\"hidden\" name=\"ids[]\" value=\"" . $section['nodeid'] . "\" />\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">$sequence</td>\n"; $result .= " <td align=\"" . vB_Template_Runtime::fetchStyleVar('left') . "\" class=\"$bgclass\" style=\"font-size:80%;width:400px;\"><div class=\"sectionTitleWrapper\" style=\"width:400px;\"> " . $change_display_order_buttons . $section_name_prefix . "<a href=\"./cms_content_admin.php?do=filter§ionid=" . $section['nodeid'] . "&contenttypeid=" . vb_Types::instance()->getContentTypeID("vBCms_Section") . "\" target=\"_self\" >" . htmlspecialchars_uni($section['title']) . "</a> <div style=\"float:" . vB_Template_Runtime::fetchStyleVar('right') . "\"> <a href=\"javascript:showSectionEdit('new_section'," . (intval($section['parentnode']) ? $section['parentnode'] : '0') . ", " . $section['nodeid'] . ",'')\"><img src=\"" . self::getImagePath('imgdir_cms') . "/add_small.png\" style=\"border-style:none\"></a> <a href=\"javascript:showSectionEdit('save_section',". (intval($section['parentnode']) ? $section['parentnode'] : '0') . ', ' . $section['nodeid'] . ", '" . vB_Template_Runtime::escapeJS(htmlspecialchars_uni($section['title'])) . "')\")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/edit_small.png\" style=\"border-style:none\"></a>" . ((intval($section['nodeid']) != 1 AND intval($section['section_count']) == 0 AND intval($section['item_count']) == 0) ? "<a href=\"javascript:confirmSectionDelete(" . $section['nodeid'] . ', \'' . vB_Template_Runtime::escapeJS($vbphrase['confirm_deletion']). "');\"> <img src=\"" . self::getImagePath('imgdir_cms') . "/delete_small.png\" style=\"border-style:none\"></a>" : '') . " </div> </div></td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select name=\"state_" . $section['nodeid']. "\" id=\"state_" . $section['nodeid']. "\" onchange=\"setFormValue('do', 'saveonesectionstate'); setFormValue('nodeid', " . $section['nodeid']. ");document.getElementById('cms_data').submit();\">" . self::getPublishedSelect( intval($section['setpublish']), $section['publishdate']) . "</select></td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select id=\"cl_" . $section['nodeid'] . "\" name=\"cl_" . $section['nodeid'] . "\" onchange=\"setFormValue('do','saveonecl'); setFormValue('nodeid'," . $section['nodeid'] . "); document.getElementById('cms_data').submit();\">" . self::getContentLayoutSelect($section['content_layoutid']) ; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select name=\"sect_pr_" . $section['nodeid'] . "\" onchange=\"setFormValue('nodeid', " . $section['nodeid']. "); setFormValue('do', 'sectionpriority');document.getElementById('cms_data').submit();\">\n" . self::getSectionPrioritySelect($section['priority'], $section['nodeid']) . "</select></td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . self::getSectionPPEdit($section['per_page'], $section['nodeid']) . "</td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['section_count'] . "</td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['item_count'] . "</td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['viewcount'] . "</td>\n"; $result .= "</tr>\n"; } print_hidden_fields(); $result .= "</table>"; $result .= "</div></td></tr>"; $result .= "</table>\n"; $result .= self::getNav($per_page, $record_count, $page, 'section', 100, 'page', true, ('cms_content_admin.php' . ($sectionid ? "?sectionid=$sectionid" : ''))); global $echoform; $echoform = false; $result .= "</form>"; $result .= self::getSectionEditPanel(); return $result; } }