} else { if ($vbulletin->GPC['type'] == 'menu') { $pshow = $tabs; $tdesc = $vbphrase['add_new_menu']; } else { if ($vbulletin->GPC['type'] == 'link') { $pshow = $parents; $tdesc = $vbphrase['add_new_link']; } else { print_stop_message('invalid_type'); } } } $count = 0; $name = $vbulletin->GPC['type']; $name .= '_' . strtolower(substr(vb_base64_encode(TIMENOW), 4, 4)); do { $count++; if ($count > 100) { /* Something is very wrong */ print_stop_message('internal_error', '20'); } $name .= '_' . rand(100, 999); } while (isset($roots[$name])); print_form_header('navigation', 'doadd'); print_table_header($tdesc); construct_hidden_code('type', $vbulletin->GPC['type']); construct_hidden_code('tabid', $navelement['root']); construct_hidden_code('identity', $name); print_label_row($vbphrase['identity'], $name); if (!$vbulletin->debug) {
/** * Attempts to send email based on parameters passed into start()/quick_set() * * @return boolean Returns false on error */ protected function exec_send() { if (!$this->toemail) { return false; } $this->smtpSocket = fsockopen(($this->secure == 'ssl' ? 'ssl://' : 'tcp://') . $this->smtpHost, $this->smtpPort, $errno, $errstr, 30); if ($this->smtpSocket) { if (!$this->sendMessage(false, 220)) { return $this->errorMessage($this->smtpReturn . ' Unexpected response when connecting to SMTP server'); } // do initial handshake if (!$this->sendHello()) { return $this->errorMessage($this->smtpReturn . ' Unexpected response from SMTP server during handshake'); } if ($this->secure == 'tls' and function_exists('stream_socket_enable_crypto')) { if ($this->sendMessage('STARTTLS', 220)) { if (!stream_socket_enable_crypto($this->smtpSocket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { return $this->errorMessage('Unable to negotitate TLS handshake.'); } } // After TLS say Hi again $this->sendHello(); } if ($this->smtpUser and $this->smtpPass) { if ($this->sendMessage('AUTH LOGIN', 334)) { if (!$this->sendMessage(vb_base64_encode($this->smtpUser), 334) or !$this->sendMessage(vb_base64_encode($this->smtpPass), 235)) { return $this->errorMessage($this->smtpReturn . ' Authorization to the SMTP server failed'); } } } if (!$this->sendMessage('MAIL FROM:<' . $this->fromemail . '>', 250)) { return $this->errorMessage($this->smtpReturn . ' Unexpected response from SMTP server during FROM address transmission'); } // we could have multiple addresses since a few people might expect this to be the same as PHP $addresses = explode(',', $this->toemail); foreach ($addresses as $address) { if (!$this->sendMessage('RCPT TO:<' . trim($address) . '>', 250)) { return $this->errorMessage($this->smtpReturn . ' Unexpected response from SMTP server during TO address transmission'); } } if ($this->sendMessage('DATA', 354)) { $this->sendMessage('Date: ' . gmdate('r'), false); $this->sendMessage('To: ' . $this->toemail, false); $this->sendMessage(trim($this->headers), false); // trim to prevent double \r\n $this->sendMessage('Subject: ' . $this->subject, false); $this->sendMessage("\r\n", false); // this makes a double \r\n // catch any single dots on their own $this->message = preg_replace('#^\\.' . $this->delimiter . '#m', '..' . $this->delimiter, $this->message); $this->sendMessage($this->message, false); } else { return $this->errorMessage($this->smtpReturn . ' Unexpected response from SMTP server during data transmission'); } if (!$this->sendMessage('.', 250)) { return $this->errorMessage($this->smtpReturn . ' Unexpected response from SMTP server when ending transmission'); } // Don't check that QUIT returns a valid result as some servers just kill the connection e.g. smtp.gmail.com $this->sendMessage('QUIT', 221); fclose($this->smtpSocket); $this->log_email(); return true; } else { return $this->errorMessage('Unable to connect to SMTP server'); } }
/** * Signs a string we intend to pass to the client but don't want them to alter * * @param string String to be signed * * @return string MD5 hash followed immediately by the string */ function sign_client_string($string, $extra_entropy = '') { if (preg_match('#[\\x00-\\x1F\\x80-\\xFF]#s', $string)) { $string = vb_base64_encode($string); $prefix = 'B64:'; } else { $prefix = ''; } return $prefix . sha1($string . sha1(COOKIE_SALT) . $extra_entropy) . $string; }
/** * Generates the style for the style generator * * @param array contains all color data * @param int Number for the parent id * @param string Title for the genrated style * @param boolean Override version check * @param int Display order for the style * @param boolean True / False whether it will be user selectable * @param int Version * */ function generate_style($data, $parentid, $title, $anyversion = false, $displayorder, $userselect, $version) { global $vbulletin; require_once DIR . '/includes/class_xml.php'; // Need to check variable for values - Check to make sure we have a name etc $arr = explode('{', stripslashes($data)); // checked below $hex = array(0 => ''); // start at one $match = $match2 = array(); // initialize $type = 'lps'; // checked below // Get master stylevar data $svdata = $vbulletin->db->query_read("\n\t\tSELECT stylevarid\n\t\tFROM " . TABLE_PREFIX . "stylevar\n\t\tWHERE styleid = -1\n\t"); // Generate list $masterlist = array(); while ($svlist = $vbulletin->db->fetch_array($svdata)) { $masterlist[$svlist['stylevarid']] = true; } foreach ($arr as $key => $value) { if (preg_match("/\"hex\":\"([0-9A-F]{6})\"/", $value, $match) == 1) { $hex[] = '#' . $match[1]; } if (preg_match("/\"type\":\"([a-z0-9]{3})\"/", $value, $match2) == 1) { $type = $match2[1]; } } switch (count($hex)) { case '11': break; default: print_stop_message('incorrect_color_mapping'); } switch ($type) { case 'lpt': // White : Similar to the current style $sample_file = "style_generator_sample_white.xml"; $from = array('#A60000', '#BF3030', '#FF4040', '#FF7373'); $to = array($hex[3], $hex[2], $hex[1], $hex[1]); break; case 'gry': // Grey :: Primary 3 and Primary 4 only $sample_file = "style_generator_sample_gray.xml"; $from = array('#A60000', '#FF4040'); $to = array($hex[1], $hex[4]); break; case 'drk': // Dark : Primary 3 and Primary 4 only $sample_file = "style_generator_sample_dark.xml"; $from = array('#A60000', '#FF4040'); $to = array($hex[1], $hex[4]); break; case 'lps': // Light : Primary and Secondary // Light : Primary and Secondary default: // Default to lps (as previously set at start of function, not dark). $sample_file = "style_generator_sample_light.xml"; $from = array('#FF0000', '#BF3030', '#A60000', '#FF4040', '#FF7373', '#009999', '#1D7373', '#5CCCCC'); $to = array($hex[1], $hex[2], $hex[3], $hex[4], $hex[5], $hex[6], $hex[7], $hex[10]); break; } $decode = $match = array(); $xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/' . $sample_file); $styledata = $xmlobj->parse(); foreach ($styledata['stylevars']['stylevar'] as $stylevars) { // The XML Parser outputs 2 values for the value field when one is set as an attribute. // The work around for now is to specify the first value (the attribute). In reality // the parser shouldn't add a blank 'value' if it exists as an attribute. $decode[$stylevars['name']] = vb_base64_decode($stylevars['value'][0]); } // Preg match and then replace. Shutter, a better method is on the way. $match = array(); foreach ($decode as $name => $value) { if (preg_match("/\"(#[a-zA-Z0-9]{6})\"/", $value, $match) == 1) { $upper = '"' . strtoupper($match[1]) . '"'; $stylevarparts[$name] = str_replace($from, $to, preg_replace("/\"(#[a-zA-Z0-9]{6})\"/", $upper, $value)); } } if ($title === '') { $title = 'Style ' . time(); } $xml = new vB_XML_Builder($vbulletin); $xml->add_group('style', array('name' => $title, 'vbversion' => $version, 'product' => 'vbulletin', 'type' => 'custom')); $xml->add_group('stylevars'); foreach ($stylevarparts as $stylevarid => $stylevar) { // Add if exists if ($masterlist[$stylevarid]) { $xml->add_tag('stylevar', '', array('name' => htmlspecialchars_uni($stylevarid), 'value' => vb_base64_encode($stylevar))); } } // Close stylevar group $xml->close_group(); // Close style group $xml->close_group(); $doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n\r\n"; $doc .= $xml->output(); $xml = null; if ($parentid == -1 or $parentid == -2) { $masterstyleid = $parentid; } else { $style = $vbulletin->db->query_first("\n\t\t\tSELECT IF(type = 'standard', '-1', '-2') AS masterstyleid\n\t\t\tFROM " . TABLE_PREFIX . "style\n\t\t\tWHERE styleid = {$parentid}\n\t\t"); $masterstyleid = $style['masterstyleid']; } xml_import_style($doc, $masterstyleid, $parentid, $title, $anyversion, $displayorder, $userselect, null, null, 1); print_cp_redirect("template.php?" . $vbulletin->session->vars['sessionurl'] . "do=rebuild&goto=template.php?" . $vbulletin->session->vars['sessionurl']); }
function get_product_export_xml($productid) { global $vbulletin; // Set up the parent tag $product_details = $vbulletin->db->query_first("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "product\n\t\tWHERE productid = '" . $vbulletin->db->escape_string($productid) . "'\n\t"); if (!$product_details) { throw new vB_Exception_AdminStopMessage('invalid_product_specified'); } require_once DIR . '/includes/class_xml.php'; $xml = new vB_XML_Builder($vbulletin); // -1 means also export -2 $export_styleid = -1; $export_languageids = array(-1, 0); // ############## main product info $xml->add_group('product', array('productid' => strtolower($product_details['productid']), 'active' => $product_details['active'])); // Parent for product $xml->add_tag('title', $product_details['title']); $xml->add_tag('description', $product_details['description']); $xml->add_tag('version', $product_details['version']); $xml->add_tag('url', $product_details['url']); $xml->add_tag('versioncheckurl', $product_details['versioncheckurl']); ($hook = vBulletinHook::fetch_hook('admin_product_export')) ? eval($hook) : false; // ############## dependencies $product_dependencies = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "productdependency\n\t\tWHERE productid = '" . $vbulletin->db->escape_string($productid) . "'\n\t\tORDER BY dependencytype, parentproductid, minversion\n\t"); $xml->add_group('dependencies'); while ($product_dependency = $vbulletin->db->fetch_array($product_dependencies)) { $deps = array('dependencytype' => $product_dependency['dependencytype']); if ($product_dependency['dependencytype'] == 'product') { $deps['parentproductid'] = $product_dependency['parentproductid']; } $deps['minversion'] = $product_dependency['minversion']; $deps['maxversion'] = $product_dependency['maxversion']; $xml->add_tag('dependency', '', $deps); } $xml->close_group(); // ############## install / uninstall codes $productcodes = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "productcode\n\t\tWHERE productid = '" . $vbulletin->db->escape_string($productid) . "'\n\t"); $xml->add_group('codes'); $productcodes_grouped = array(); $productcodes_versions = array(); while ($productcode = $vbulletin->db->fetch_array($productcodes)) { // have to be careful here, as version numbers are not necessarily unique $productcodes_versions["{$productcode['version']}"] = 1; $productcodes_grouped["{$productcode['version']}"][] = $productcode; } $productcodes_versions = array_keys($productcodes_versions); usort($productcodes_versions, 'version_sort'); foreach ($productcodes_versions as $version) { foreach ($productcodes_grouped["{$version}"] as $productcode) { $xml->add_group('code', array('version' => $productcode['version'])); $xml->add_tag('installcode', $productcode['installcode']); $xml->add_tag('uninstallcode', $productcode['uninstallcode']); $xml->close_group(); } } $xml->close_group(); //hack in the ability to handle styles other than the master in a sane fashion. //We can set it via a hook for the moment, it should be a fairly temporary need. //There was some logic that look like you might be able to export more than one //style, but it didn't make much sense -- if you selected multiple styles then //you'd end up with templates from multiple styles with no attempt to handle duplicates //and no requirement that the styles in question were parents/children of each other. if ($export_styleid == -1) { // -1 means also export -2 $sqlcondition = "styleid IN (-1, -2)"; $parentlist = "-1,-2"; } else { // query everything from the specified style $style = $vbulletin->db->query_first("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "style\n\t\t\tWHERE styleid = " . $export_styleid); $sqlcondition = "templateid IN(" . implode(',', unserialize($style['templatelist'])) . ")"; $parentlist = $style['parentlist']; } // ############## templates $gettemplates = $vbulletin->db->query_read("\n\t\tSELECT\n\t\t\ttitle, templatetype, username, dateline, version, product, styleid,\n\t\t\tIF(templatetype = 'template', template_un, template) AS template\n\t\tFROM " . TABLE_PREFIX . "template\n\t\tWHERE\n\t\t\tproduct = '" . $vbulletin->db->escape_string($productid) . "'\n\t\t\t\tAND\n\t\t\t{$sqlcondition}\n\t\tORDER BY\n\t\t\ttitle\n\t"); $mobile_templates = array(); $xml->add_group('templates'); while ($template = $vbulletin->db->fetch_array($gettemplates)) { if (is_newer_version($template['version'], $product_details['version'])) { // version in the template is newer than the version of the product, // which probably means it's using the vB version $template['version'] = $product_details['version']; } if ($template['styleid'] == -2) { $mobile_templates[] = $template; continue; } $xml->add_tag('template', $template['template'], array('name' => htmlspecialchars_uni($template['title']), 'templatetype' => $template['templatetype'], 'date' => $template['dateline'], 'username' => $template['username'], 'version' => htmlspecialchars_uni($template['version'])), true); } $xml->close_group('templates'); if ($mobile_templates) { $xml->add_group('templates_mobile'); foreach ($mobile_templates as $template) { $xml->add_tag('template', $template['template'], array('name' => htmlspecialchars_uni($template['title']), 'templatetype' => $template['templatetype'], 'date' => $template['dateline'], 'username' => $template['username'], 'version' => htmlspecialchars_uni($template['version'])), true); } $xml->close_group('templates_mobile'); unset($mobile_templates); } // ############## Stylevars require_once DIR . '/includes/adminfunctions_template.php'; if ($export_styleid == -1) { $stylevarinfo = get_stylevars_for_export($productid, -1); $stylevarinfo_mobile = get_stylevars_for_export($productid, -2); $stylevar_cache_mobile = $stylevarinfo_mobile['stylevars']; $stylevar_dfn_cache_mobile = $stylevarinfo_mobile['stylevardfns']; } else { $stylevarinfo = get_stylevars_for_export($productid, $parentlist); } $stylevar_cache = $stylevarinfo['stylevars']; $stylevar_dfn_cache = $stylevarinfo['stylevardfns']; $xml->add_group('stylevardfns'); foreach ($stylevar_dfn_cache as $stylevargroupname => $stylevargroup) { $xml->add_group('stylevargroup', array('name' => $stylevargroupname)); foreach ($stylevargroup as $stylevar) { $xml->add_tag('stylevar', '', array('name' => htmlspecialchars_uni($stylevar['stylevarid']), 'datatype' => $stylevar['datatype'], 'validation' => vb_base64_encode($stylevar['validation']), 'failsafe' => vb_base64_encode($stylevar['failsafe']))); } $xml->close_group('stylevargroup'); } $xml->close_group('stylevardfns'); unset($stylevar_dfn_cache); $xml->add_group('stylevars'); foreach ($stylevar_cache as $stylevarid => $stylevar) { $xml->add_tag('stylevar', '', array('name' => htmlspecialchars_uni($stylevar['stylevarid']), 'value' => vb_base64_encode($stylevar['value']))); } $xml->close_group('stylevars'); unset($stylevar_cache); if ($stylevar_dfn_cache_mobile) { $xml->add_group('stylevardfns_mobile'); foreach ($stylevar_dfn_cache_mobile as $stylevargroupname => $stylevargroup) { $xml->add_group('stylevargroup', array('name' => $stylevargroupname)); foreach ($stylevargroup as $stylevar) { $xml->add_tag('stylevar', '', array('name' => htmlspecialchars_uni($stylevar['stylevarid']), 'datatype' => $stylevar['datatype'], 'validation' => vb_base64_encode($stylevar['validation']), 'failsafe' => vb_base64_encode($stylevar['failsafe']))); } $xml->close_group('stylegroup'); } $xml->close_group('stylevardfns_mobile'); unset($stylevar_dfn_cache_mobile); $xml->add_group('stylevars_mobile'); foreach ($stylevar_cache_mobile as $stylevarid => $stylevar) { $xml->add_tag('stylevar', '', array('name' => htmlspecialchars_uni($stylevar['stylevarid']), 'value' => vb_base64_encode($stylevar['value']))); } $xml->close_group('stylevars_mobile'); unset($stylevar_cache_mobile); } // ############## plugins $xml->add_group('plugins'); $plugins = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "plugin\n\t\tWHERE product = '" . $vbulletin->db->escape_string($productid) . "'\n\t\tORDER BY hookname\n\t"); while ($plugin = $vbulletin->db->fetch_array($plugins)) { $params = array('active' => $plugin['active'], 'executionorder' => $plugin['executionorder']); $xml->add_group('plugin', $params); $xml->add_tag('title', $plugin['title']); $xml->add_tag('hookname', $plugin['hookname']); $xml->add_tag('phpcode', $plugin['phpcode']); $xml->close_group(); } unset($plugin); $vbulletin->db->free_result($plugins); $xml->close_group(); // ############## phrases require_once DIR . '/includes/adminfunctions_language.php'; $phrasetypes = fetch_phrasetypes_array(false); $phrases = array(); $getphrases = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "phrase\n\t\tWHERE languageid IN (" . implode(',', $export_languageids) . ")\n\t\t\tAND product = '" . $vbulletin->db->escape_string($productid) . "'\n\t\tORDER BY languageid, fieldname, varname\n\t"); while ($getphrase = $vbulletin->db->fetch_array($getphrases)) { $phrases["{$getphrase['fieldname']}"]["{$getphrase['varname']}"] = $getphrase; } unset($getphrase); $vbulletin->db->free_result($getphrases); $xml->add_group('phrases'); // make sure the phrasegroups are in a reliable order ksort($phrases); foreach ($phrases as $_fieldname => $typephrases) { // create a group for each phrase type that we have phrases for // then insert the phrases $xml->add_group('phrasetype', array('name' => $phrasetypes["{$_fieldname}"]['title'], 'fieldname' => $_fieldname)); // make sure the phrases are in a reliable order ksort($typephrases); foreach ($typephrases as $phrase) { $xml->add_tag('phrase', $phrase['text'], array('name' => $phrase['varname'], 'date' => $phrase['dateline'], 'username' => $phrase['username'], 'version' => htmlspecialchars_uni($phrase['version'])), true); } $xml->close_group(); } $xml->close_group(); // ############## options $setting = array(); $settinggroup = array(); $groups = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "settinggroup\n\t\tWHERE volatile = 1\n\t\tORDER BY displayorder, grouptitle\n\t"); while ($group = $vbulletin->db->fetch_array($groups)) { $settinggroup["{$group['grouptitle']}"] = $group; } ksort($settinggroup); $options = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "setting\n\t\tWHERE product = '" . $vbulletin->db->escape_string($productid) . "'\n\t\t\tAND volatile = 1\n\t\tORDER BY displayorder, varname\n\t"); while ($row = $vbulletin->db->fetch_array($options)) { $setting["{$row['grouptitle']}"][] = $row; } unset($row); $vbulletin->db->free_result($options); $xml->add_group('options'); foreach ($settinggroup as $grouptitle => $group) { if (empty($setting["{$grouptitle}"])) { continue; } // add a group for each setting group we have settings for $xml->add_group('settinggroup', array('name' => htmlspecialchars_uni($group['grouptitle']), 'displayorder' => $group['displayorder'])); ksort($setting["{$grouptitle}"]); foreach ($setting["{$grouptitle}"] as $set) { $arr = array('varname' => $set['varname'], 'displayorder' => $set['displayorder']); if ($set['advanced']) { $arr['advanced'] = 1; } $xml->add_group('setting', $arr); if ($set['datatype']) { $xml->add_tag('datatype', $set['datatype']); } if ($set['optioncode'] != '') { $xml->add_tag('optioncode', $set['optioncode']); } if ($set['validationcode']) { $xml->add_tag('validationcode', $set['validationcode']); } if ($set['defaultvalue'] !== '') { $xml->add_tag('defaultvalue', $set['defaultvalue']); } if ($set['blacklist']) { $xml->add_tag('blacklist', 1); } $xml->close_group(); } $xml->close_group(); } $xml->close_group(); // ############## admin help $help_topics_results = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "adminhelp\n\t\tWHERE product = '" . $vbulletin->db->escape_string($productid) . "'\n\t\t\tAND volatile = 1\n\t\tORDER BY script, action, displayorder, optionname\n\t"); $help_topics = array(); while ($help_topic = $vbulletin->db->fetch_array($help_topics_results)) { $help_topics["{$help_topic['script']}"][] = $help_topic; } $vbulletin->db->free_result($help_topics_results); ksort($help_topics); $xml->add_group('helptopics'); foreach ($help_topics as $script => $script_topics) { $xml->add_group('helpscript', array('name' => $script)); foreach ($script_topics as $topic) { $attr = array('disp' => $topic['displayorder']); if ($topic['action']) { $attr['act'] = $topic['action']; } if ($topic['optionname']) { $attr['opt'] = $topic['optionname']; } $xml->add_tag('helptopic', '', $attr); } $xml->close_group(); } $xml->close_group(); // ############## Cron entries $cron_results = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "cron\n\t\tWHERE product = '" . $vbulletin->db->escape_string($productid) . "'\n\t\t\tAND volatile = 1\n\t\t\tAND varname <> ''\n\t\tORDER BY varname\n\t"); $xml->add_group('cronentries'); while ($cron = $vbulletin->db->fetch_array($cron_results)) { $minutes = unserialize($cron['minute']); if (!is_array($minutes)) { $minutes = array(); } $xml->add_group('cron', array('varname' => $cron['varname'], 'active' => $cron['active'], 'loglevel' => $cron['loglevel'])); $xml->add_tag('filename', $cron['filename']); $xml->add_tag('scheduling', '', array('weekday' => $cron['weekday'], 'day' => $cron['day'], 'hour' => $cron['hour'], 'minute' => implode(',', $minutes))); $xml->close_group(); } $xml->close_group(); $vbulletin->db->free_result($cron_results); // ############## FAQ entries $faq_results = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "faq\n\t\tWHERE product = '" . $vbulletin->db->escape_string($productid) . "'\n\t\t\tAND volatile = 1\n\t\tORDER BY faqname\n\t"); $xml->add_group('faqentries'); while ($faq = $vbulletin->db->fetch_array($faq_results)) { $xml->add_tag('faq', '', array('faqname' => $faq['faqname'], 'faqparent' => $faq['faqparent'], 'displayorder' => $faq['displayorder'])); } $xml->close_group(); $vbulletin->db->free_result($faq_results); // Navigation Data // $xml->add_group('navigation'); $navdata = $vbulletin->db->query_read_slave("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "navigation\n\t\tWHERE\n\t\t\tproductid = '" . $vbulletin->db->escape_string($productid) . "'\n\t\t\t\tAND\n\t\t\tstate & " . $vbulletin->bf_misc_navstate['deleted'] . " = 0\n\t\tORDER BY\n\t\t\tnavtype, parent, displayorder\n\t"); while ($nav = $vbulletin->db->fetch_array($navdata)) { $row = array('name' => $nav['name'], 'date' => $nav['dateline'], 'username' => $nav['username'], 'version' => $nav['version']); $taglist = array(); expand_navigation_state($nav); switch ($nav['navtype']) { case 'tab': $taglist = array('active' => $nav['active'], 'show' => $nav['showperm'], 'scripts' => $nav['scripts'], 'displayorder' => $nav['displayorder'], 'url' => $nav['url'], 'menuid' => $nav['menuid'], 'newpage' => $nav['newpage']); break; case 'menu': $taglist = array('active' => $nav['active'], 'show' => $nav['showperm'], 'parent' => $nav['parent'], 'displayorder' => $nav['displayorder']); break; case 'link': $taglist = array('active' => $nav['active'], 'show' => $nav['showperm'], 'parent' => $nav['parent'], 'displayorder' => $nav['displayorder'], 'url' => $nav['url'], 'newpage' => $nav['newpage']); break; } if ($nav['protected']) { if ($nav['default']) { $taglist['default'] = 1; } } else { if (substr($nav['product'], 0, 2) == 'vb') { continue; } } $xml->add_group($nav['navtype'], $row); foreach ($taglist as $key => $value) { $xml->add_tag($key, $value); } $xml->close_group($nav['navtype']); } $xml->close_group('navigation'); // ############## Finish up $xml->close_group(); $doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n\r\n" . $xml->output(); unset($xml); return $doc; }
public function addListMembers($sessionid, $listid, $members, $fields) { if (!$sessionid or !$listid or empty($members)) { return false; } if (!$this->vr) { $this->vr = new SoapClient($this->wsdl); } try { $result = $this->vr->appendFileToList(array('session_id' => $sessionid, 'list_id' => $listid, 'file' => array('filename' => 'vb_upload_tmp', 'delimiter' => 'csv', 'contents' => vb_base64_encode($members)), 'fields' => $fields)); return true; } catch (exception $e) { //Probably an expired login return false; } }