Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2005, 10:29 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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); 
Reply With Quote
  #2  
Old 09-27-2005, 04:01 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you sure the xml-file is correct?
Reply With Quote
  #3  
Old 09-27-2005, 07:41 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i did add one little thing to it>_>
Reply With Quote
  #4  
Old 09-28-2005, 10:20 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok well did me adding action="xxx" to the <template> tag break the parser?
Reply With Quote
  #5  
Old 09-29-2005, 03:21 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Difficult to say without seeing the XML-file.
Reply With Quote
  #6  
Old 09-30-2005, 01:42 AM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

here is the xml file i am using
Attached Files
File Type: xml vbj_templates_upgrade2.xml (78.0 KB, 8 views)
Reply With Quote
  #7  
Old 09-30-2005, 03:39 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #8  
Old 09-30-2005, 09:46 AM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is for vbulletin 3.0.x and there are only style importers not just template importers.
Reply With Quote
  #9  
Old 09-30-2005, 05:42 PM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 09-30-2005, 09:24 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what if i wanted this to overwrite existing templates?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:00 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.08867 seconds
  • Memory Usage 2,311KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete