vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   style xml file parsing issue! (https://vborg.vbsupport.ru/showthread.php?t=96968)

AN-net 09-26-2005 09:29 PM

style xml file parsing issue!
 
i get this error:
Code:

Warning: xml_parse(): 17 is not a valid XML Parser resource in /admincp/journalupgrade2.php on line 99
my code is:
PHP Code:

print_form_header("journalupgrade" $upgradingto ".php"'stepthree');
            
print_table_header("vB Journal Upgrade: " $versions[$currentversion-1] ." to " $versions[$nextversion-1] . "(Step 2/3)");
            require_once(
'./includes/adminfunctions_template.php');
            if (!(
$xml file_read('./'.$admincpdir.'/vbj_templates_upgrade' $upgradingto '.xml')))
            {
                
print_description_row("<b>Can Not Find Journal Template File</b>(vbj_templates_upgrade" $upgradingto ".xml)");
            }
            else
            {
                
$intemplate 0;
                
$counter 0;
                
$curtag '';
                
$arr = array();
                
                
$parser xml_parser_create();
                
xml_parser_set_option($parserXML_OPTION_CASE_FOLDING0);
                
xml_set_element_handler($parser'xml_parse_style_otag''xml_parse_style_ctag');
                
xml_set_character_data_handler($parser'xml_parse_style_cdata');
                
xml_parser_free($parser);
                
/*
                if (!@xml_parse($parser, $xml))
                {
                    print_description_row("<b>Can Not Parse Journal Template File</b>(vbj_templates_upgrade" . $upgradingto . ".xml)");
                }
                */
                
xml_parse($parser$xml);
                
                
                require_once(
'./includes/functions_xml.php');
                foreach(
$arr AS $title => $template)
                {
                    
$title addslashes($title);
                    
$template['template'] = addslashes(xml_unescape_cdata($template['template']));
                    
$template['username'] = addslashes(xml_unescape_cdata($template['username']));
                    
print_r($template);
            
                    if (
$template['templatetype'] != 'template')
                    {
                        
// template is a special template
                        
$querybits[] = "($styleid, '$template[templatetype]', '$title', '$template[template]', '', $template[dateline], '$template[username]', '" addslashes($template['version']) . "')";
                    }
                    else
                    {
                        
// template is a standard template
                        
$querybits[] = "($styleid, '$template[templatetype]', '$title', '" addslashes(compile_template(stripslashes($template['template']))) . "', '$template[template]', $template[dateline], '$template[username]', '" addslashes($template['version']) . "')";
                    }
                }
            }
            
print_submit_row("Continue on to Step 3 of 3"0); 


Marco van Herwaarden 09-27-2005 03:01 AM

Are you sure the xml-file is correct?

AN-net 09-27-2005 06:41 PM

i did add one little thing to it>_>

AN-net 09-28-2005 09:20 PM

ok well did me adding action="xxx" to the <template> tag break the parser?

Marco van Herwaarden 09-29-2005 02:21 AM

Difficult to say without seeing the XML-file.

AN-net 09-30-2005 12:42 AM

1 Attachment(s)
here is the xml file i am using

Marco van Herwaarden 09-30-2005 02:39 AM

I guess i didn't good read the original error message.

Aren't you calling xml_parse_free to early? I guess the parser resource is already freed and don't exist anymore when you call xml_parse().

PS What vB version is this for? Why don't you use the buildin vB xml functions?

AN-net 09-30-2005 08:46 AM

this is for vbulletin 3.0.x and there are only style importers not just template importers.

deathemperor 09-30-2005 04:42 PM

then why don't you use the vbulletin function to import style ?

it's xml_import_style() btw.

ok this is what I did:

PHP Code:

    // Install templates
    
require_once(DIR '/includes/adminfunctions_template.php');
    
// +++++++++
    // XML Temps
    // +++++++++

    
if (!($xml file_read('./'.$vbulletin->datastore->registry->config[Misc][admincpdir].'/jukebox.xml')))
    {
        
print_form_header('jukebox_install''start');
        
print_table_header("Jukebox 1.1 Installation");
        
construct_hidden_code('caction''4');
        
print_description_row("Error. jukebox.xml located in directory '".$vbulletin->datastore->registry->config[Misc][admincpdir]."' was not found. Please make sure it is uploaded then press the submit button below");
        
print_submit_row("Add Templates"0);
    } 
    else 
    {
        
$All_Styles $vbulletin->db->query("select styleid from " TABLE_PREFIX "style where parentid < 0"); // Grab master styles only
        
while($SID $vbulletin->db->fetch_array($All_Styles))
        {
            
$ID[] = $SID['styleid'];
        }
        foreach(
$ID as $StyleID)
        {
            
xml_import_style($xml$StyleID, -1''1);
        }
        
define('NO_POST_EDITOR_BUILD'true);
        
build_all_styles();
    } 

credit goes to Zero Tolerance.

AN-net 09-30-2005 08:24 PM

what if i wanted this to overwrite existing templates?


All times are GMT. The time now is 01:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01800 seconds
  • Memory Usage 1,776KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete