Posts: 242 Location: New York
Tue 23 Mar, 2010 17:21
Subject: Automatic Post From Php
Is there a way to post in a topic something written in a php file? :roll:
something like this:
http://www.phpbb.com/community/viewtopic.php?f=70&t=587212
Posts: 7192 Location: Borgo San Michele
Thu 25 Mar, 2010 12:19
Subject: Re: Automatic Post From Php
Currently there is no automatic option or MOD for doing that in Icy Phoenix.
It depends on what you need, it should not be tough to be implemented.
Posts: 242 Location: New York
Thu 25 Mar, 2010 12:22
Subject: Re: Automatic Post From Php
I want to post simply a string, link an "echo"
Posts: 7192 Location: Borgo San Michele
Thu 25 Mar, 2010 12:24
Subject: Re: Automatic Post From Php
But where, under which conditions?
Posts: 242 Location: New York
Thu 25 Mar, 2010 12:29
Subject: Re: Automatic Post From Php
can you remember your mod viewtopic_views_prize?
In that case I want to post username in a topic...
and in lottery_mod, I want to post the winner username in an other topic
Posts: 7192 Location: Borgo San Michele
Thu 25 Mar, 2010 12:56
Subject: Re: Automatic Post From Php
Try to have a look at how posting.php and the submit_post() function work. Everything you need is there.
It should not be tough doing that.
Posts: 242 Location: New York
Thu 25 Mar, 2010 15:09
Subject: Re: Automatic Post From Php
Do I have to see all
case reply?
case 'reply':
// CrackerTracker v5.x
if ($ctracker_config->settings['vconfirm_guest'] == 1 && !$userdata['session_logged_in'])
{
define('CRACKER_TRACKER_VCONFIRM', true);
define('POST_CONFIRM_CHECK', true);
include_once(IP_ROOT_PATH . 'ctracker/engines/ct_visual_confirm.' . PHP_EXT);
}
// CrackerTracker v5.x
$username = (!empty($_POST['username'])) ? $_POST['username'] : '';
$subject = (!empty($_POST['subject'])) ? trim($_POST['subject']) : '';
$topic_desc = (!empty($_POST['topic_desc'])) ? trim($_POST['topic_desc']) : '';
$message = (!empty($_POST['message'])) ? trim($_POST['message']) : '';
$topic_calendar_time = ($topic_calendar_time != $post_data['topic_calendar_time'] && !$is_auth['auth_cal']) ? $post_data['topic_calendar_time'] : $topic_calendar_time;
if (empty($topic_calendar_time)) $topic_calendar_time = 0;
$topic_calendar_duration = ($topic_calendar_duration != $post_data['topic_calendar_duration'] && !$is_auth['auth_cal']) ? $post_data['topic_calendar_duration'] : $topic_calendar_duration;
if (!empty($topic_calendar_duration))
{
$topic_calendar_duration--;
}
if (empty($topic_calendar_time) || empty($topic_calendar_duration))
{
$topic_calendar_duration = 0;
}
$poll_title = (isset($_POST['poll_title']) && $is_auth['auth_pollcreate']) ? $_POST['poll_title'] : '';
$poll_options = (isset($_POST['poll_option_text']) && $is_auth['auth_pollcreate']) ? $_POST['poll_option_text'] : '';
$poll_length = (isset($_POST['poll_length']) && $is_auth['auth_pollcreate']) ? $_POST['poll_length'] : '';
// Event Registration - BEGIN
$reg_active = (isset($_POST['start_registration']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['start_registration'] : '';
$reg_reset = (isset($_POST['reset_registration']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reset_registration'] : '';
$reg_max_option1 = (!empty($_POST['reg_max_option1']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reg_max_option1'] : '';
$reg_max_option2 = (!empty($_POST['reg_max_option2']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reg_max_option2'] : '';
$reg_max_option3 = (!empty($_POST['reg_max_option3']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reg_max_option3'] : '';
$reg_length = (isset($_POST['reg_length']) && $is_auth['auth_vote'] && $userdata['session_logged_in']) ? $_POST['reg_length'] : '';
// Event Registration - END
$notes = empty($_POST['notes']) ? '' : trim(stripslashes($_POST['notes']));
prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $subject, $message, $poll_title, $poll_options, $poll_length, $reg_active, $reg_reset, $reg_max_option1, $reg_max_option2, $reg_max_option3, $reg_length, $topic_desc, $topic_calendar_time, $topic_calendar_duration);
// MG Drafts - BEGIN
if (($board_config['allow_drafts'] == true) && $draft && $draft_confirm && $userdata['session_logged_in'] && (($mode == 'reply') || ($mode == 'newtopic')))
{
save_draft($draft_id, $userdata['user_id'], $forum_id, $topic_id, ip_addslashes(strip_tags($subject)), ip_addslashes($message));
//save_draft($draft_id, $userdata['user_id'], $forum_id, $topic_id, str_replace("\'", "''", strip_tags($subject)), str_replace("\'", "''", $message));
$message = $lang['Drafts_Saved'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(VIEWFORUM_MG . '?' . POST_FORUM_URL . '=' . $forum_id) . '">', '</a>');
$redirect_url = append_sid(VIEWFORUM_MG . '?' . POST_FORUM_URL . '=' . $forum_id);
meta_refresh(3, $redirect_url);
message_die(GENERAL_MESSAGE, $message);
}
// MG Drafts - END
if ($error_msg == '')
{
if ($mode == 'reply')
{
$topic_type = $post_data['topic_type'];
}
else
{
$topic_type = (($topic_type != $post_data['topic_type']) && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] && !$is_auth['auth_globalannounce']) ? $post_data['topic_type'] : $topic_type;
}
if(($mode == 'editpost') && ($board_config['edit_notes'] == 1) && (strlen($notes) > 2))
{
$sql = "SELECT edit_notes FROM " . POSTS_TABLE . " WHERE post_id='" . $post_id . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$notes_list = strlen($row['edit_notes']) ? unserialize($row['edit_notes']) : array();
// check limit and delete notes
if(count($notes_list) >= intval($board_config['edit_notes_n']))
{
if($notes_list[$i]['poster'] == $userdata['user_id'])
{
$del_num = $i;
}
for($i = count($notes_list) - 1; $i >= 0; $i--)
{
$del_num = $i;
}
if($del_num >= 0)
{
$new_list = array();
for($n = 0; $n < count($notes_list); $n++)
{
if($n !== $del_num)
{
$new_list[] = $notes_list[$n];
}
}
$notes_list = $new_list;
}
}
$notes_list[] = array(
'poster' => $userdata['user_id'],
'time' => time(),
//'text' => htmlspecialchars($notes)
'text' => $notes
);
empty_cache_folders(POSTS_CACHE_FOLDER);
$sql = "UPDATE " . POSTS_TABLE . " SET edit_notes='" . addslashes(serialize($notes_list)) . "' WHERE post_id='" . $post_id . "'";
$db->sql_query($sql);
// We need this, otherwise editing for normal users will be account twice!
$edit_count_sql = '';
if($userdata['user_level'] == ADMIN)
{
$edit_count_sql = ", post_edit_count = (post_edit_count + 1)";
}
$edited_sql = "post_edit_time = '" . time() . "'" . $edit_count_sql . ", post_edit_id = '" . $userdata['user_id'] . "'";
$sql = "UPDATE " . POSTS_TABLE . " SET " . $edited_sql . " WHERE post_id='" . $post_id . "'";
$db->sql_query($sql);
}
if ($lock_subject)
{
$url = '[url="' . VIEWTOPIC_MG . '?' . (!empty($forum_id_append) ? ($forum_id_append . '&') : '') . (!empty($topic_id_append) ? ($topic_id_append . '&') : '') . POST_POST_URL . '=' . $lock_subject . '#p' . $lock_subject . '"]';
$message = addslashes(sprintf($lang['Link_to_post'], $url, '[/url]')) . $message;
}
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $acro_auto_on, $smilies_on, $attach_sig, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length, $reg_active, $reg_reset, $reg_max_option1, $reg_max_option2, $reg_max_option3, $reg_length, $news_category, $topic_show_portal, $mark_edit, str_replace("\'", "''", $topic_desc), $topic_calendar_time, $topic_calendar_duration);
}
break;
Posts: 7192 Location: Borgo San Michele
Fri 02 Apr, 2010 09:19
Subject: Re: Automatic Post From Php
Reply is for replying to topics, while newtopic is for creating new topics. ;-)
Page 1 of 1
You
cannot post new topics
You
cannot reply to topics
You
cannot edit your posts
You
cannot delete your posts
You
cannot vote in polls
You
cannot attach files
You
can download files
You
cannot post calendar events