/** * Private * Verifies that fetch_table_info() has been called for a valid table and sets current error condition to none * .. in other words verify that fetchTableInfo returns true before proceeding on * * @param void * * @return void */ function init_table_info() { global $vbulletin; // need registry! if (!$this->init) { $this->fetch_table_info(); } if (!$this->init) { $message = '<strong>vB_Database_Alter</strong>: fetch_table_info() has not been called successfully.<br />' . $this->fetch_error_message(); if ($vbulletin->GPC['ajax']) { require_once DIR . '/includes/class_xml.php'; $xml = new vB_XML_Builder_Ajax('text/xml'); $xml->add_tag('error', $message); $xml->print_xml(); } else { echo $message; exit; } } $this->set_error(); }
public static function getAssetPicker($userinfo, $registry) { //see if this user has an album we can use for background images. $albums = vB_dB_Assertor::instance()->assertQuery('CustomProfileAlbums', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'userid' => $userinfo['userid'])); $album = $albums->current(); $album_select = ''; while ($albums->valid()) { $album_select .= "<option value=\"" . $album['albumid'] . "\">" . $album['title'] . "</option>\n"; $album = $albums->next(); } require_once DIR . '/includes/class_xml.php'; $xml = new vB_XML_Builder_Ajax('text/xml'); if (empty($album_select)) { $xml->add_group('error'); $xml->add_tag('phrase', 'need_public_album_text'); } else { $xml->add_group('content'); $template = vB_Template::create('memberinfo_assetpicker'); $template->register('album_select', $album_select); $phrase = new vB_Phrase('profilefield', 'select_album_to_view'); $template->register('select_album_to_view', $phrase); $body = $template->render(); $template = vB_Template::create('memberinfo_assetpicker_footer'); $footer = $template->render(); $header = new vB_Phrase('profilefield', 'asset_picker'); //Now format this as an xml array. $xml->add_tag('body', $body); $xml->add_tag('header', $header); $xml->add_tag('footer', $footer); } $xml->close_group(); $xml->print_xml(); }
/** * Halts execution and shows the specified message * * @param string Message to display * @param mixed If specified, a redirect will be performed to the URL in this parameter * @param integer If redirect is specified, this is the time in seconds to delay before redirect * @param string If specified, will provide a specific URL for "Go Back". If empty, no button will be displayed! * @param bool If true along with redirect, 'CONTINUE' button will be used instead of automatic redirect */ function print_cp_message($text = '', $redirect = NULL, $delay = 1, $backurl = NULL, $continue = false) { global $vbulletin, $vbphrase; if ($vbulletin->GPC['ajax']) { require_once DIR . '/includes/class_xml.php'; $xml = new vB_XML_Builder_Ajax('text/xml'); $xml->add_tag('error', $text); $xml->print_xml(); exit; } if ($redirect) { if (($hashpos = strpos($redirect, '#')) !== false or ($hashpos = strpos($redirect, '%23')) !== false) { $hashsize = strpos($redirect, '#') !== false ? 1 : 3; $hash = substr($redirect, $hashpos + $hashsize); $redirect = substr($redirect, 0, $hashpos); } if ($session = vB::getCurrentSession()->get('sessionurl')) { if (strpos($redirect, $session) !== false) { if (strpos($redirect, '?') === false) { $redirect .= '?' . $session; } else { $redirect .= '&' . $session; } } } } if (!defined('DONE_CPHEADER')) { print_cp_header($vbphrase['vbulletin_message']); } print_form_header('', '', 0, 1, 'messageform', '65%'); print_table_header(new vB_Phrase('global', 'vbulletin_message')); print_description_row("<blockquote><br />{$text}<br /><br /></blockquote>"); if ($redirect) { // redirect to the new page if ($continue) { $continueurl = create_full_url(str_replace('&', '&', $redirect)); if (!empty($hash)) { $continueurl .= '#' . $hash; } print_table_footer(2, construct_button_code(new vB_Phrase('global', 'continue'), $continueurl)); } else { print_table_footer(); $redirect_click = create_full_url($redirect); if (!empty($hash)) { $redirect_click .= '#' . $hash; $redirect .= '#' . $hash; } $redirect_click = str_replace('"', '', $redirect_click); echo '<p align="center" class="smallfont">' . construct_phrase($vbphrase['if_you_are_not_automatically_redirected_click_here_x'], $redirect_click) . "</p>\n"; print_cp_redirect($redirect, $delay); } } else { // end the table and halt if ($backurl === NULL) { $backurl = 'javascript:history.back(1)'; } if (strpos($backurl, 'history.back(') !== false) { //if we are attempting to run a history.back(1), check we have a history to go back to, otherwise attempt to close the window. $back_button = ' <input type="button" id="backbutton" class="button" value="' . $vbphrase['go_back'] . '" title="" tabindex="1" onclick="if (history.length) { history.back(1); } else { self.close(); }"/> <script type="text/javascript"> <!-- if (history.length < 1 || ((is_saf || is_moz) && history.length <= 1)) // safari + gecko start at 1 { document.getElementById("backbutton").parentNode.removeChild(document.getElementById("backbutton")); } //--> </script>'; // remove the back button if it leads back to the login redirect page if (strpos($vbulletin->url, 'login.php?do=login') !== false) { $back_button = ''; } } else { if ($backurl !== '') { // regular window.location=url call $backurl = create_full_url($backurl); $backurl = str_replace(array('"', "'"), '', $backurl); $back_button = '<input type="button" class="button" value="' . new vB_Phrase('global', 'go_back') . '" title="" tabindex="1" onclick="window.location=\'' . $backurl . '\';"/>'; } else { $back_button = ''; } } print_table_footer(2, $back_button); } // and now terminate the script print_cp_footer(); }