Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#46 2011-12-15 15:10:57

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

You have to move this block outside the ign_if_logged_in conditional:

<label for="message"><txp:text item="comment_message" /></label>
<txp:comment_message_input />
<txp:comments_help /></div>
<txp:comment_preview />
<txp:comment_submit />

Also, I just noticed if_cookie is not a native tag— despite appearances, it belongs to the czg_if_comment_cookies plugin. If you don’t have that plugin, you should get rid of the if_cookie tags.

Offline

#47 2011-12-15 16:08:38

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

thanks, now I understand 100%, how working this code. Big thanks! :)

Offline

#48 2011-12-17 03:22:11

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

// =================
// TXPhorum
// A simple forum solution for Textpattern
// Test site and instructions: http://www.benbruce.com/txphorum
// Support forum thread: http://forum.textpattern.com/viewtopic.php?id=20775
register_callback('txphorum_mem','mem_form.submit');
function txphorum_mem_preferences($what)
{
	$lang = array(
		'section'           => 'forums',
		'reply_section'           => 'forums_replies',
		'category'           => 'category name is here..',
		'parent_custom_field'           => 'custom1',
	);
	return $lang[$what];
}
function txphorum_mem()
{
	global $mem_form_values;
//---- check if this IS a txphorum_mem submit; if not, return
// currently using Body to check for this
	if (!$mem_form_values['txphorum_mem_Body']) { 
		return; 
	}
	else { // this IS a txphorum_mem submit
		include_once txpath.'/lib/classTextile.php';
		$textile = new Textile();
		$lite = 0;
		$noimage = 0;
		extract($mem_form_values);
		$date_and_time = date("F j, Y, g:i a");
		if (!$txphorum_mem_Author) {
			$txphorum_mem_Author = 'Guest';
		}
		if ($txphorum_mem_Title == '?') {
				$txphorum_mem_Title = "question: $date_and_time";
		}
		if ($txphorum_mem_Title == '/') {
				$txphorum_mem_Title = "slash: $date_and_time";
		}
		$txphorum_mem_Body_html = $textile->TextileRestricted($txphorum_mem_Body, $lite, $noimage);
		// check if gps('edit')
		if (gps('edit')) {
			$txphorum_mem_id = gps('edit');
			safe_update(
				"textpattern",
				"Body            = '$txphorum_mem_Body',
				Body_html       = '$txphorum_mem_Body_html'",
				"ID=$txphorum_mem_id"
			); 
			return;
		}
// put in "if !$txphorum_mem_section then preferences etc (will allow for setting these with mem_form_secret if you like
		$section = txphorum_mem_preferences('section');
		$category1 = txphorum_mem_preferences('category');
		$when = 'now()';
			if ($txphorum_mem_Parent) {
			$section = txphorum_mem_preferences('reply_section'); // overwriting $section
			$txphorum_mem_Title = "$txphorum_mem_Author reply to $txphorum_mem_Parent on $date_and_time";
			$thecount = safe_field('count(*)','textpattern','custom_1='.$txphorum_mem_Parent);
			$thecount = assert_int($thecount);
			$thecount = $thecount+1;
			$updated = safe_update('textpattern','comments_count='.$thecount,'ID='.$txphorum_mem_Parent);
			$updated_b = safe_update('textpattern','lastMod=' . $when,'ID='.$txphorum_mem_Parent);
		}
		$url_title = stripSpace($txphorum_mem_Title, 1);
		safe_insert(
			   "textpattern",
			   "Title           = '$txphorum_mem_Title',
				Body            = '$txphorum_mem_Body',
				Body_html       = '$txphorum_mem_Body_html',
				Excerpt         = '',
				Excerpt_html    = '',
				Image           = '',
				Keywords        = '',
				Status          = '4',
				Posted          = $when,
				LastMod         = now(),
				AuthorID        = '$txphorum_mem_Author',
				Section         = '$section',
				Category1       = '$category1',
				Category2       = '',
				textile_body    = '1',
				textile_excerpt = '1',
				Annotate        = '0',
				override_form   = '',
				url_title       = '$url_title',
				AnnotateInvite  = 'Comment',
				custom_1        = '$txphorum_mem_Parent',
				custom_2        = '',
				custom_3        = '',
				custom_4        = '',
				custom_5        = '',
				custom_6        = '',
				custom_7        = '',
				custom_8        = '',
				custom_9        = '',
				custom_10       = '',
				uid				= '".md5(uniqid(rand(),true))."',
				feed_time		= now()"
		); 
		$thecount ='';
		$txphorum_mem_Parent= '';
	}
}
function txphorum_original_body() {
	$edit = gps('edit');
	$txphorum_original_body = fetch('Body','textpattern','ID',"$edit");
	return $txphorum_original_body;
}
function bab_link($atts) {
	extract(lAtts(array(
		'name' => 'txphorum_index',
	),$atts));
	$bab_link = fetch('url','txp_link','linkname',"$name");
	return $bab_link;
}
function bab_parent($atts) {
	global $thisarticle;
	$field = txphorum_mem_preferences('parent_custom_field');
	$id = $thisarticle[$field];
	if (!$id) { $id = $thisarticle['thisid']; }
	extract(lAtts(array(
		'display' => 'ID',
	),$atts));
	$parents = safe_row('*','textpattern',"ID='$id'");
	extract($parents); 
	return $$display;
}
function bab_author($atts)
{
	global $thisarticle;
	extract(lAtts(array(
		'type' => '0',
	),$atts));
	$author = $thisarticle['authorid']; 
	if ($type == '1') {
		$author = safe_field('RealName', 'txp_users', "name = '$author'");
	}
	return $author;
}
function bab_if_author($atts, $thing) {
	global $thisarticle, $ign_user;
	$bab_author = $thisarticle['authorid'];
	if(!$bab_author) {$bab_author = 'Guest'; }
	if ($ign_user == $bab_author) { $number = '1'; } else { $number = '0'; }
	return parse(EvalElse($thing, ("$number" > 0 )));
}
function bab_if_gps($atts, $thing) {
	extract(lAtts(array(
		'check_for' => 'edit',
	),$atts));
	if (gps($check_for)) { $number = 1; } else { $number = 0; }
	return parse(EvalElse($thing, ("$number" > 0)));
}
if ( @txpinterface == 'admin' ) {
	if (gps('install_txphorum')) {
		// style: -- base64'ed		
		$create_sql[] = "INSERT INTO `".PFX."txp_css` VALUES ('txphorum', 'Ym9keSB7DQoJZm9udC1mYW1pbHk6dmVyZGFuYSBzYW5zLXNlcmlmOw0KCWZvbnQtc2l6ZToxNHB4Ow0KfQ0KI3R4cGhvcnVtX21hc3RlciB7IH0NCiN0eHBob3J1bV9tYXN0ZXIgZmllbGRzZXQgew0KCXBhZGRpbmc6MTBweDsNCgl3aWR0aDo3MCUNCn0NCiN0eHBob3J1bV9tYXN0ZXIgb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nbjpyaWdodDsNCn0NCi50YWdsaW5lX2lucHV0IHsNCgl3aWR0aDo0MDBweDsNCn0NCi50eHBob3J1bV9zdWJtaXQgew0KCW1hcmdpbi1sZWZ0OjE3NXB4Ow0KfQ0KLnR4cGhvcnVtX2VkaXRfdGV4dGFyZWF7DQoJaGVpZ2h0OjQwMHB4Ow0KfQ==')";
// page: \" and \' and \r\n returns and \t tabs		
$create_sql[] = "INSERT INTO `".PFX."txp_page` VALUES ('txphorum', '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\r\n<head>\r\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n\t<meta http-equiv=\"cache-control\" content=\"no-cache\" />\r\n\r\n\t<title><txp:page_title /></title>\r\n\r\n\t<txp:feed_link flavor=\"atom\" format=\"link\" label=\"Atom\" />\r\n\t<txp:feed_link flavor=\"rss\" format=\"link\" label=\"RSS\" />\r\n\r\n\t<txp:css format=\"link\" />\r\n</head>\r\n\r\n<body>\r\n\r\n<div id=\"txphorum_master\">\r\n\r\n<!-- #### Row 1: search and login/manage -->\r\n\r\n\t<div id=\"txphorum_search_login_container\">\r\n\r\n\t\t<div id=\"txphorum_login\">\r\n\t\t\t<txp:ign_if_logged_in>\r\n\t\t\t\t<a href=\"<txp:bab_link name=\"txphorum_manage_profile\" />\">Update your profile</a> or <txp:ign_logout_link>Logout</txp:ign_logout_link>\r\n\t\t\t<txp:else />\r\n\t\t\t\t<txp:ign_show_login form=\"txphorum_login_form\" />\r\n\t\t\t</txp:ign_if_logged_in>\r\n\t\t</div><!-- /txphorum_login -->\r\n\r\n\t\t<div id=\"txphorum_search\">\r\n\t\t\t<form method=\"get\" action=\"<txp:bab_link name=\"txphorum_index\" />\">Search: <input type=\"text\" name=\"q\" value=\"\" size=\"20\" /></form>\r\n\t\t</div><!-- /txphorum_search -->\r\n\r\n\t</div><!-- /txphorum_search_login_container -->\r\n\r\n\t<txp:if_search>\r\n\r\n<!-- #### Row 2 (a): search results -->\r\n\r\n\t\t<div id=\"txphorum_search_results_container\">\r\n\r\n\t\t\t<fieldset>\r\n\t\t\t\t<legend><a href=\"<txp:bab_link name=\"txphorum_index\" />\">Discussions</a> / Search Results&nbsp;</legend>\r\n\t\t\t\t<txp:article searchall=\"0\" />\r\n\r\n\t<txp:else />\r\n\r\n<!-- #### Row 2 (b): index or edit/article. if edit, show edit form or not allowed -->\r\n\r\n\t\t<div id=\"txphorum_article_container\">\r\n\r\n\t\t\t<fieldset>\r\n\t\t\t\t<txp:if_individual_article>\r\n\t\t\t\t\t<txp:article form=\"txphorum_post\" />\r\n\t\t\t\t<txp:else /><!-- if_individual_article -->\r\n\t\t\t\t\t<legend>Discussions&nbsp;</legend>\r\n\t\t\t\t\t<ul><txp:article form=\"txphorum_index\" limit=\"10\" sort=\"LastMod desc\" /></ul>\r\n\t\t\t\t\t<div id=\"txphorum_paginate_older\"><txp:older>More discussions --></txp:older></div>\r\n\t\t\t\t\t<div id=\"txphorum_paginate_newer\"><txp:newer><-- More discussions</txp:newer></div>\r\n\t\t\t\t</txp:if_individual_article>\r\n\r\n\t</txp:if_search>\r\n\r\n\t\t\t</fieldset>\r\n\r\n\t\t</div><!-- /txphorum_search_results_container or /txphorum_article_container -->\r\n\r\n<txp:ign_if_logged_in>\r\n<!-- #### Row 3: Begin a/Add to the Discussion -->\r\n\r\n\t<txp:if_section name=\"txphorum\" >\r\n\t\t<txp:bab_if_gps check_for=\"edit\">\r\n\t\t\t<!-- nothing -->\r\n\t\t<txp:else />\r\n\r\n\t\t\t<div id=\"txphorum_discussion_container\">\r\n\r\n\t\t\t\t<fieldset>\r\n\t\t\t\t\t<txp:if_individual_article>\r\n\t\t\t\t\t\t<legend>Add to the Discussion&nbsp;</legend>\r\n\t\t\t\t\t<txp:else />\r\n\t\t\t\t\t\t<legend>Begin a Discussion&nbsp;</legend>\r\n\t\t\t\t\t</txp:if_individual_article>\r\n\r\n\t\t\t\t\t<txp:asy_wondertag><txp:mem_form type=\"form\" redirect=\"<txp:page_url />\" form=\"txphorum_discussion_form\" /></txp:asy_wondertag>\r\n\r\n\t\t\t\t</fieldset>\r\n\r\n\t\t\t</div><!-- txphorum_discussion_container -->\r\n\r\n\t\t</txp:bab_if_gps>\r\n\t</txp:if_section>\r\n</txp:ign_if_logged_in>\r\n<!-- #### Row 4: Guidelines, Help, etc -->\r\n\r\n\t<div id=\"txphorum_bottom_container\">\r\n\r\n\t\t<a href=\"<txp:bab_link name=\"txphorum_manage_help\" />\">Help</a> | <a href=\"<txp:bab_link name=\"txphorum_manage_guidelines\" />\">Guidelines</a> | <txp:email linktext=\"Contact the Admin\" email=\"forum_admin@example.com?subject=Comment&body=Write%20your%20comment%20here:%20%20\" />\r\n\r\n\t</div><!-- /txphorum_bottom_container -->\r\n\r\n</div><!-- /txphorum_master -->\r\n\r\n\r\n</body>\r\n</html>')";
		// forms: \" and \r\n returns and \t tabs
		// txphorum_discussion_form
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_discussion_form', 'article', '<txp:if_individual_article>\r\n\t\t\t\t\t\t\t<txp:asy_wondertag><txp:mem_form_secret name=\"txphorum_mem_Parent\" value=\"<txp:article_id />\" /></txp:asy_wondertag>\r\n\t\t\t\t\t\t<txp:else />\r\n\t\t\t\t\t\t\t<div class=\"label\">Title:&nbsp;</div>\r\n\t\t\t\t\t\t\t<div class=\"mem_input\"><txp:asy_wondertag><txp:mem_form_text label=\"\" name=\"txphorum_mem_Title\" break=\"\" class=\"mem_input\" /></txp:asy_wondertag></div>\r\n\t\t\t\t\t\t</txp:if_individual_article>\r\n\t\t\t\t\t\t\t<txp:asy_wondertag><txp:mem_form_secret name=\"txphorum_mem_Author\" value=\"<txp:ign_user_info type=\"name\" />\" /></txp:asy_wondertag>\r\n\r\n\t\t\t\t\t\t<div class=\"label\">Body:&nbsp;</div>\r\n\t\t\t\t\t\t<div><txp:asy_wondertag><txp:mem_form_textarea label=\"\" name=\"txphorum_mem_Body\" break=\"\" class=\"mem_input\" /></txp:asy_wondertag></div>\r\n\t\t\t\t\t\t<txp:output_form form=\"txphorum_textile_help\" />\r\n\r\n\t\t\t\t\t\t\t<div class=\"txphorum_submit\"><txp:mem_form_submit /></div>')";
		// txphorum_edit_form
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_edit_form', 'article', '<div id=\"txphorum_edit_container\">\r\n\r\n<div class=\"label\">Body:&nbsp;</div><div><txp:asy_wondertag><txp:mem_form_textarea label=\"\" name=\"txphorum_mem_Body\" default=\"<txp:txphorum_original_body />\" break=\"br\" class=\"txphorum_edit_textarea\" /></txp:asy_wondertag></div>\r\n\t\t<txp:output_form form=\"txphorum_textile_help\" />\r\n\t\t<div class=\"txphorum_submit\"><txp:mem_form_submit /></div>\r\n</div><!-- /txphorum_edit_container -->')";
		//txphorum_index
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_index', 'article', '<li><txp:permlink><txp:title /></txp:permlink> (Replies: <txp:comments_count />)</li>')";
		//login_form
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_login_form', 'article', '(u): <txp:ign_user_field /> (p): <txp:ign_pass_field /> <txp:ign_submit_field value=\"Login\" /> or <a href=\"<txp:bab_link name=\"txphorum_manage_register\" />\">Register</a>')";
		//post
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_post', 'article', '<txp:bab_if_gps check_for=\"edit\">\r\n\r\n\t<legend><a href=\"<txp:bab_link name=\"txphorum_index\" />\">Discussions</a> / Edit \"<txp:title />\"&nbsp;</legend>\r\n\t<txp:bab_if_author>\r\n\r\n\t\t<txp:asy_wondertag><txp:mem_form type=\"form\" redirect=\"<txp:bab_link name=\"txphorum_index\" />/<txp:bab_parent display=\"url_title\" />\" form=\"txphorum_edit_form\" /></txp:asy_wondertag>\r\n\r\n\t<txp:else />\r\n\t\t<p>You are not authorized.</p>\r\n\t</txp:bab_if_author>\r\n\r\n<txp:else /><!-- bab_if_gps -->\r\n\r\n\t<legend><a href=\"<txp:bab_link name=\"txphorum_index\" />\">Discussions</a> / \"<txp:title />\"&nbsp;</legend>\r\n\r\n\t<div id=\"txphorum_post_container\">\r\n\r\n\t\t<txp:if_section name=\"txphorum\">\r\n\t\t\t<div class=\"txphorum_author_posted\" ><txp:bab_author type=\"0\" /> / <txp:posted /></div>\r\n\t\t</txp:if_section>\r\n\r\n\t\t<div><txp:body /></div>\r\n\r\n\t\t<txp:if_section name=\"txphorum\">\r\n\t\t\t<div class=\"tagline\"><txp:bab_author type=\"1\" /></div>\r\n\t\t</txp:if_section>\r\n\r\n\t\t<txp:if_section name=\"txphorum\">\r\n\t\t\t<div class=\"txphorum_edit_report\"><txp:bab_if_author><a href=\"?edit=<txp:article_id />\">Edit</a> | </txp:bab_if_author><txp:asy_wondertag><txp:email linktext=\"Report\" email=\"moderation_request@example.com?subject=Moderation Request: <txp:article_id />&body=http://www.example.net/textpattern/index.php?event=list\" /></txp:asy_wondertag></div>\r\n\t\t</txp:if_section>\r\n\r\n\t</div><!-- /txphorum_post_container -->\r\n\r\n\t<txp:asy_wondertag><txp:article_custom custom1=\"<txp:article_id />\" form=\"txphorum_reply\" sort=\"Posted asc\" limit=\"1000\" /></txp:asy_wondertag>\r\n\r\n</txp:bab_if_gps>')";
		//reply
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_reply', 'article', '<div class=\"txphorum_reply_container\" >\r\n\r\n\t<div class=\"txphorum_author_posted\" ><txp:bab_author type=\"0\" /> / <txp:posted /></div>\r\n\t<div><txp:body /></div>\r\n\t<div class=\"tagline\"><txp:bab_author type=\"1\" /></div>\r\n\r\n\t<txp:if_section name=\"txphorum\">\r\n\t\t<div class=\"txphorum_edit_report\">\r\n\t\t\t<txp:bab_if_author>\r\n\t\t\t\t<a href=\"<txp:permlink />?edit=<txp:article_id />\">Edit</a> | \r\n\t\t\t</txp:bab_if_author>\r\n\t\t\t<txp:asy_wondertag><txp:email linktext=\"Report\" email=\"moderation_request@example.com?subject=Moderation Request: <txp:article_id />&body=http://www.example.net/textpattern/index.php?event=list\" /></txp:asy_wondertag>\r\n\t\t</div><!-- /txphorum_edit_report -->\r\n\t</txp:if_section>\r\n\t\r\n</div><!-- /txphorum_reply_container -->')";
		//self-reg
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_self_register_form', 'article', '<table><tr><td>Username (this cannot be changed):</td><td><txp:mem_form_text name=\"name\" label=\"\" break=\"\" /></td></tr><tr><td>Email: </td><td><txp:mem_form_email name=\"email\" label=\"\" break=\"\" /></td></tr><tr><td>Tagline (64 characters max): </td><td><txp:mem_form_text name=\"RealName\" label=\"\" break=\"\" /></td></tr><tr><td></td><td><txp:mem_form_submit /></td></tr></table>')";
		//textile_help
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_textile_help', 'article', '<div class=\"txphorum_textile_help\">*bold* | _italicize_ | \"link\":http://www.example.com | * bulleted list | !imageurl! | <a href=\"/txphorum_manage/help\">More</a></div>')";
		// articles
		//register
		$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES ('', now(), 'Forum Admin', now(), '', 'Register', '', 'Registering for the Forum offers several benefits, but is not required to participate in discussions. Current benefits include:\r\n\r\n* Edit your posts.\r\n* You can change your tagline and account email address at any time.\r\n\r\n<txp:mem_self_register_form form=\"txphorum_self_register_form\" />', 'Registering for the Forum offers several benefits, but is not required to participate in discussions. Current benefits include:\r\n\r\n* Edit your posts.\r\n* You can change your tagline and account email address at any time.\r\n\r\n<txp:mem_self_register_form form=\"txphorum_self_register_form\" />', '', '\n\n\n ', '', '', '', 1, 'Comment', 1, 4, 1, 1, 'txphorum_manage', '', '', 'register', '', '', '', '', '', '', '', '', '', '', 'babfea8fd42801204463b23701199f28', 0x323030352d30372d3333)";
		//profile
		$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES ('', now(), 'Forum Admin', now(), '', 'Profile', '', '<txp:ign_if_logged_in><txp:mem_self_user_edit_form><table><tr><td><b>Profile:</b><br /><br /></td><td></td></tr><tr><td>Username (cannot be changed):</td><td><txp:ign_user_info type=\"name\" /></td></tr><tr><td>Tagline (64 characters max.):</td><td><txp:mem_realname_input  label=\"\" class=\"mem_input tagline_input\" /></td></tr><tr><td>Email Address:</td><td><txp:mem_email_input  label=\"\" class=\"mem_input\" /></td></tr><tr><td></td><td><txp:mem_submit /></td></tr></txp:mem_self_user_edit_form><txp:mem_self_change_password_form><tr><td><b>Change your password:</b></td><td></td></tr><tr><td>New Password:</td><td><txp:mem_password_input label=\"\" /></td></tr><tr><td></td><td><txp:mem_submit /></td></tr></table></txp:mem_self_change_password_form><txp:else /><p>You aren\'t <a href=\"/txphorum_manage/register\">registered</a>!</p></txp:ign_if_logged_in>', '<txp:ign_if_logged_in><txp:mem_self_user_edit_form><table><tr><td><b>Profile:</b><br /><br /></td><td></td></tr><tr><td>Username (cannot be changed):</td><td><txp:ign_user_info type=\"name\" /></td></tr><tr><td>Tagline (64 characters max.):</td><td><txp:mem_realname_input  label=\"\" class=\"mem_input tagline_input\" /></td></tr><tr><td>Email Address:</td><td><txp:mem_email_input  label=\"\" class=\"mem_input\" /></td></tr><tr><td></td><td><txp:mem_submit /></td></tr></txp:mem_self_user_edit_form><txp:mem_self_change_password_form><tr><td><b>Change your password:</b></td><td></td></tr><tr><td>New Password:</td><td><txp:mem_password_input label=\"\" /></td></tr><tr><td></td><td><txp:mem_submit /></td></tr></table></txp:mem_self_change_password_form><txp:else /><p>You aren\'t <a href=\"/txphorum_manage/register\">registered</a>!</p></txp:ign_if_logged_in>', '', '\n\n\n ', '', '', '', 1, 'Comment', 1, 4, 1, 1, 'txphorum_manage', '', '', 'profile', '', '', '', '', '', '', '', '', '', '', 'bab2ea8fd42801204463b23701199f28', 0x323030352d30372d3334)";
		//guidelines
		$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES ('', now(), 'Forum Admin', now(), '', 'Guidelines', '', 'Coming soon!', '<p>Coming soon!</p>', '', '\n\n\n ', '', '', '', 1, 'Comment', 1, 4, 1, 1, 'txphorum_manage', '', '', 'guidelines', '', '', '', '', '', '', '', '', '', '', 'bab3ea8fd42801204463b23701199f28', 0x323030352d30372d3335)";
		//help
		$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES ('', now(), 'Forum Admin', now(), '', 'Help', '', 'Coming soon!', '<p>Coming soon!</p>', '', '\n\n\n ', '', '', '', 1, 'Comment', 1, 4, 1, 1, 'txphorum_manage', '', '', 'help', '', '', '', '', '', '', '', '', '', '', 'bab4ea8fd42801204463b23701199f28', 0x323030352d30372d3336)";
		// links
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum', 'txphorum_index', '', 'TXPhorum Index')";
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum_manage/register', 'txphorum_manage_register', '', 'TXPhorum Register')";
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum_manage/profile', 'txphorum_manage_profile', '', 'TXPhorum Profile')";
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum_manage/guidelines', 'txphorum_manage_guidelines', '', 'TXPhorum Guidelines')";
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum_manage/help', 'txphorum_manage_help', '', 'TXPhorum Help')";
		// sections
		$create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('txphorum', 'txphorum', 'txphorum', 0, 0, 0, 0, 'TXPhorum')";
		$create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('txphorum_manage', 'txphorum', 'txphorum', 0, 0, 0, 0, 'TXPhorum Management')";
		$create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('txphorum_replies', 'txphorum', 'txphorum', 0, 0, 0, 0, 'TXPhorum Replies')";	
		foreach ($create_sql as $query)
		{
			$result = mysql_query($query);
		} // end foreach
	} // end if gps
} // end if admin

How to make, that plugin automatically choose category, where article is added?
Example: I am in category: textpattern, then article adds to section: forums and category: textpattern.
I think, that it need edit in plugin code.

Last edited by elwins (2011-12-17 03:30:02)

Offline

#49 2011-12-17 04:08:53

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

If that thing above, posted by elwins, is from the plugin’s source code, I would not recommend using it. Seriously, you shouldn’t be using that in any situation. That code has some very serious security vulnerabilities.

Offline

#50 2011-12-17 05:32:36

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

Its default code, only place what has changed is:

$lang = array(
		'section'           => 'forums',
		'reply_section'           => 'forums_replies',
		'category'           => 'category name is here..',
		'parent_custom_field'           => 'custom1',
	);

But I think, that some part of that code propobly is lost, because there was problems with posting it.

Offline

#51 2011-12-17 05:45:28

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

elwins wrote:

Its default code

In such case, I would advice uninstalling the plugin. It’s not safe to use.

Last edited by Gocom (2011-12-17 05:45:53)

Offline

#52 2011-12-17 08:22:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,463
Website GitHub

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

elwins

I’ve already donethe category thing, and more besides, in my (unreleased) modded version. I can’t remember how many of the security loopholes I closed offhand. Maybe some, maybe none — it was a loooong time ago I last looked at it. I’m due to revisit this over the next few weeks if you can wait a bit.

Gocom

In case you’re at a loose end over the holidays, could you please jot down some of the security issues and let me have them by e-mail. I can see a bunch of them in the code above (unescaped things, lack of doSlash(), etc) which I’ve probably caught already, but in case I missed any I’d appreciate your expertise on this. Thanks, man.

Last edited by Bloke (2011-12-17 08:23:00)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#53 2011-12-17 14:34:26

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

Bloke wrote:

I’ve already donethe category thing, and more besides, in my (unreleased) modded version. I can’t remember how many of the security loopholes I closed offhand. Maybe some, maybe none — it was a loooong time ago I last looked at it. I’m due to revisit this over the next few weeks if you can wait a bit.

maybe you can give me now that category thing? I Just need to get visual side done, and then later, security side.

Last edited by elwins (2011-12-17 14:34:55)

Offline

#54 2011-12-18 16:22:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,463
Website GitHub

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

elwins wrote:

maybe you can give me now that category thing? I Just need to get visual side done, and then later, security side.

Not right now. I’m travelling and it’s at home. maybe when I get back.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#55 2011-12-18 19:00:06

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

ok, when will you be back at home? :)

Offline

#56 2012-01-12 16:08:56

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

Someone then can help me?

Offline

Board footer

Powered by FluxBB