vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Auto-creation of threads? (https://vborg.vbsupport.ru/showthread.php?t=61030)

Xenon 02-06-2004 01:01 PM

the subforum would be modification hints and tips :)

as for your problem: hmm, wierd, it seems like you are calling the function files out of the wrong directory.

isn't your script located within the forum directory?

you may want to add a chdir('..'); before the first require once of your script above.

Wired1 02-06-2004 07:53 PM

Yes, the test file was outside the directory. Moving it inside did get rid of that, but more have come :)

Fatal error: Call to a member function on a non-object in ...forums/includes/functions.php on line 259

That line is within the function fetch_phrase, which is used in function verify_post_errors, which is used in this snippet within functions_new_post.
PHP Code:

    if ($_REQUEST['fromquickreply'] AND $post['preview'])
    {
        
$errors = array();
    }
    else
    {
        
verify_post_errors($type$post$errors);
    } 

Tracing code use is fun kids! lol
Ok, so $post['preview'] has already been set to 0 in the code I listed in the test file a couple of posts back. Not real sure how to set $_REQUEST['fromquickreply'] to the correct value though. Tracing it back, I think that's a default setting. I'm starting to get the feeling that a manual INSERT might work better, but I'm not giving up yet!

Xenon 02-06-2004 11:19 PM

wierd, i haven't had any problems, i added the build_newpost to a script of mine myself and it worked flawless (ok not creating a new thread, just post...)

the errormessage you have sounds like you have to add a global $DB_site; at the correct part of your script ;)

or better said, does your script include the global.php so the connection to the DB is set up already?

Wired1 02-07-2004 01:00 AM

... ... ... nope... LMAO! It was there at one point, must've deleted it accidentally! Added that, then re-ran it, got an odd vB error, refreshed, and it went in! Getting an odd error though:
Code:

Database error in vBulletin 3.0.0 Release Candidate 3:

Invalid SQL:
SELECT CONCAT(newthreademail ,' ', newpostemail) AS newpostemail
FROM forum WHERE forumid IN ()
               
mysql error: You have an error in your SQL syntax near ') ' at line 4
mysql error number: 1064

Now the data is getting into the thread in the right place. Also just found out that every time that happens, I get a DB error email lol! 2 odd things though, which I'll cover after this code, which is the latest incarnation of the test code:
Code:

require_once('./global.php');
require_once('./includes/functions_newpost.php');
require_once('./includes/functions.php');
require_once('./includes/functions_login.php');

$foruminfo['forumid'] = 10;
$threadinfo['open'] = 1;
$threadinfo['visible'] = 1;

$threadinfo['title'] = '3rd';

$post['title'] = 'sdfsdfsdf';
$post['message'] = 'This is the message stuff';

build_new_post('thread', $foruminfo, $threadinfo, 0, $post, $errors);
verify_post_errors($type, $post, $errors);

the threadinfo['title'] doesn't do diddly, even when the post['title'] is commented out. Also, I'd like the post specific title to be nothing, but I can always remove it in the postbit.

I've also found out that it uses the cookie's session to use my username/id, not the one in the test file. I was wondering if there's a way to have it log out the user, log in with the Bot's Username/PW, then after it's done, log out. Would probably be easier for the poster to just log out of their user name and login to the bot's acct.

BTW, I take it back about what I said about their code comments, was looking around the vb.com site, and found the pdf with the ERD for the database... WOAH! I'll wait to see vB3 final to see what code comments they say...

Xenon 02-07-2004 10:35 PM

replace the code
PHP Code:

$foruminfo['forumid'] = 10

with that:
PHP Code:

$forumid 10;
$foruminfo fetch_foruminfo($forumid); 

that should avoid the db error i think.

as for your second question.
if you just use the init.php instead of global.php i think it doesn't use your account, but does create the thread as well. (but i don't give guarantee for that ;))

version2 02-07-2004 11:46 PM

I am glad to see this thread because I am working on a hack that will be posting new threads and posts as well. Right now I am looking at your code and upon testing it out for myself I have two problems I can see. First I get a dberror:

PHP Code:

Invalid SQL
            
INSERT INTO post
                
(threadidparentidtitleusernameuseriddatelinepagetextallowsmilie,
                 
showsignatureipaddressiconidvisibleattach)
            
VALUES
                
(0, , '',
                 
'mol'11076204664,
                 
'This is the message stuff'10,
                 
'127.0.0.1'010

Now, the second this I see is that I passed a different username and id than the one that is being used. I assume its going off cookie info! As for using init.php, well...that didnt help much except for getting rid of the dberror. Still no thread being created.

version2 02-08-2004 12:11 AM

Ok. I have created a thread! Woot. Now, I have to figure out how to go around the cookie problem. It is still posting as a different user than what I have hardcoded into it. The next step is how to post a new post in the thread that was just created.

version2 02-08-2004 12:20 AM

Quote:

Originally Posted by version2
Ok. I have created a thread! Woot. Now, I have to figure out how to go around the cookie problem. It is still posting as a different user than what I have hardcoded into it. The next step is how to post a new post in the thread that was just created.

Well, ok. I got it. It was $threadinfo['iconid'] giving me fits of all things. I am now creating new threads and follow up posts.

Now, to fix the userid problem.

version2 02-08-2004 12:23 AM

Ok. Update. When using the init.php and bypassing global in hopes of the bbuserinfo not taking over I am getting an invalid posthash as a result:

PHP Code:

Invalid SQL
            
SELECT COUNT(*) AS count
            FROM attachment
            WHERE posthash 
'invalid posthash'
                
AND userid 


version2 02-08-2004 12:34 AM

Quote:

Originally Posted by version2
Ok. Update. When using the init.php and bypassing global in hopes of the bbuserinfo not taking over I am getting an invalid posthash as a result:

PHP Code:

Invalid SQL
            
SELECT COUNT(*) AS count
            FROM attachment
            WHERE posthash 
'invalid posthash'
                
AND userid 


All right. I am done talking to myself. Hopefully this will help someone in the future. I got around the cookie problem by declaring the username and then grabbing the bbuserinfo using that username. I am also using init.php and not global.php. Everything seems to be working. All counts are being update, etc.


All times are GMT. The time now is 09:12 AM.

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.01340 seconds
  • Memory Usage 1,765KB
  • 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
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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