<?php
/*********************/
/*               	*/
/*  bestoops.com  */
/*    	SMH  	*/
/*  	OOps Nullers	*/
/*               	*/
/*********************/
if ( $command == "Delete" )
{
	$bw = implode( " or id=", $blog_id );
	$query = "delete from mcontent where id={$bw} and owner='{$_SESSION['user']}'";
	db_query( $query );
	header( "location: ./?module=manualcontent&id={$id}" );
	exit( );
}
echo "<s";
echo "tyle type=\"text/css\">\r\n<!--\r\n.style28 {\r\n\tfont-size: large;\r\n\tfont-weight: bold;\r\n\tcolor: #000000;\r\n}\r\n.style29 {\r\n\tfont-size: large;\r\n\tfont-weight: bold;\r\n}\r\n-->\r\n</style>\r\n\r\n<br />\r\n\r\n";
$rs = db_query( "select * from blogs where id='{$id}'" );
if ( $blog = mysql_fetch_array( $rs ) )
{
	echo "\r\n<p> </p>\r\n<table width=\"95%\" border=\"0\" cellspacing=\"2\" cellpadding=\"5\">\r\n	\r\n	<tr valign=\"top\">\r\n  	<td><form action=\"./?module=manualcontent&id=";
	echo $id;
	echo "\" method=\"post\" name=\"postform\" id=\"postform\">\r\n    	<br />\r\n    	<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\r\n      	<tr>\r\n        	<td width=\"3%\" height=\"29\" valign=\"middle\"><img src=\"images/";
	echo $blog[engine];
	echo ".jpg\" alt=\"\" width=\"20\" height=\"20\" /></td>\r\n        	<td width=\"97%\" valign=\"middle\" class=\"style28\">\r\n          	POST MANUAL CONTENT</td>\r\n      	</tr>\r\n\r\n      	<tr>\r\n        	<td height=\"1\" colspan=\"2\" valign=\"top\" bgcolor=\"#F1F8FE\"></td>\r\n      	</tr>\r\n    	</table>\r\n	<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"5\">\r\n        	<tr valign=\"top\">\r\n          	<td>";
	echo "<table width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"2\" bgcolor=\"#FEFEFE\">\r\n              	<tr>\r\n                	<td width=\"17%\"><div align=\"right\">";
	echo "<s";
	echo "trong>BLOG URL</strong></div></td>\r\n                	<td width=\"83%\">";
	echo $blog[blog_url];
	echo "</td>\r\n              	</tr>\r\n              	<tr>\r\n                	<td><div align=\"right\">";
	echo "<s";
	echo "trong>TITLE</strong></div></td>\r\n                	<td><input name=\"title\" type=\"text\" class='inputtext' id=\"title\" value=\"";
	echo $title;
	echo "\" size=\"100\" />\r\n                  	*</td>\r\n              	</tr>\r\n              	<tr>\r\n                	<td valign=\"top\"><div align=\"right\">";
	echo "<s";
	echo "trong>CONTENT</strong></div></td>\r\n                	<td valign=\"top\">\r\n";
	@include( "spaw2/spaw.inc.php" );
	$spaw = new SpawEditor( "content", stripslashes( $content ), "th", "standard", "", "630px", "400px" );
	$spaw->hideModeStrip( );
	$spaw->show( );
	echo "                	<br /></td>\r\n              	</tr>\r\n              	<tr>\r\n                	<td><div align=\"right\">";
	echo "<s";
	echo "trong>Post To Category</strong></div></td>\r\n                	<td><input name=\"category\" type=\"text\" class='inputtext' id=\"category\" value=\"";
	echo $category;
	echo "\" size=\"30\" /> \r\n                  	<input name=\"button4\" type=\"button\" class=\"buttonblue\" id=\"button4\" onclick=\"window.open('categorybrowser.php?id=";
	echo "&form=postform&obj=category','','status=1,toolbar=1,location=0,menubar=0,resizeable=0,scrollbars=auto,height=200,width=350');\" value=\"Browse\" />\r\n                  	* Wordpress Only</td>\r\n              	</tr>\r\n              	<tr>\r\n                	<td> </td>\r\n                	<td>\r\n                  	<input name=\"bookmark\" type=\"checkbox\" id=\"bookmark\" value=\"yes\"  ";
	if ( $bookmark == "yes" )
	{
    	echo "checked";
	}
	echo "/> \r\n                  	Add To Bookmark\r\n\r\n";
	$rsss = db_query( "select * from bookmarks where owner='{$user}' group by profile" );
	while ( $cat = mysql_fetch_array( $rsss ) )
	{
    	$bcats[] = trim( $cat[profile] );
	}
	echo "                  	";
	echo "<s";
	echo "elect name=\"bookmark_profile\" id=\"bookmark_profile\" class=\"inputtext\"  >\r\n                    	";
	foreach ( $bcats as $cat )
	{
    	if ( $cat == $options[bookmark_profile] )
    	{
        	$sel = "selected";
    	}
    	else
    	{
        	$sel = "";
    	}
    	echo "<option value='{$cat}' {$sel}>{$cat}</option>\n";
	}
	echo "                                                              	</select>\r\n                  	<br />\r\n                	<input name=\"bookmark_mode\" type=\"radio\" id=\"radioarticle2\" value=\"all\"";
	if ( $options[bookmark_mode] == "all" )
	{
    	echo "checked";
	}
	echo " />\r\n                	Bookmark ALL\r\n                	<input name=\"bookmark_mode\" type=\"radio\" id=\"radioarticle3\" value=\"lite\"  ";
	if ( $options[bookmark_mode] == "lite" || $options[bookmark_mode] == "" )
	{
    	echo "checked";
	}
	echo " />\r\n                	Bookmark LITE<br />\r\n                	<br />\r\n                	<br /></td>\r\n              	</tr>\r\n              	<tr>\r\n                	<td> </td>\r\n                	<td><input type=\"submit\" name=\"command\" value=\"Post To Blog\" class='buttonblue' id=\"command\" /> <input type=\"submit\" name=\"command\" value=\"Add to Queued\" class='buttonblue' id=\"command\" /></td>\r\n	";
	echo "          	</tr>\r\n\t\t\t\t\r\n          	</table></td>\r\n      	</tr>\r\n        	<tr valign=\"top\">\r\n          	<td> </td>\r\n      	</tr>\r\n      	</table>\r\n    	</form>\r\n  	<font size=\"-1\"></font><font size=\"-1\"></font></td>\r\n	</tr>\r\n	<tr valign=\"top\">\r\n  	<td><hr size=\"1\">  	</td>\r\n	</tr>\r\n\t";
	if ( $command == "Post To Blog" )
	{
    	require_once( "bookmarks.php" );
    	if ( $nl2br == "yes" )
    	{
        	$content = ereg_replace( "\n", "<br>", $content );
    	}
    	ob_start( );
    	echo "	<tr valign=\"top\">\r\n  	<td><p class=\"style29\">";
    	echo $command;
    	echo " Results</p>\r\n\t  ";
    	$options = unserialize( $blog[options] );
    	if ( intval( $options[tags_minchar] ) == 0 )
    	{
        	$options[tags_minchar] = 5;
    	}
    	if ( intval( $options[tags_maxchar] ) == 0 )
    	{
        	$options[tags_maxchar] = 20;
    	}
    	if ( $options[http_user_agent] == "" )
    	{
        	$options[http_user_agent] = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1";
    	}
    	define( "FAKE_HTTP_USER_AGENT", $options[http_user_agent] );
    	$contents[type] = "Manual Content";
    	if ( $title == "" )
    	{
        	$title = "Untitle";
    	}
    	$contents[title] = $title;
    	$contents[content] = $content;
    	$contents[category] = $category;
    	require( "{$blog['engine']}.php" );
    	if ( !$contents[post_failed] )
    	{
        	echo "[ {$contents['type']} ] {$title} posted to {$blog['blog_url']}\n";
        	db_query( "update blogs set posts=posts+1 , lastpost=UNIX_TIMESTAMP() , spams=0 where id={$blog['id']} " );
        	$contents[title] = addslashes( $contents[title] );
        	if ( !isset( $b ) and& $blog[engine] == "wordpress" )
        	{
            	$b = getlastpost( $blog, $contents[post_id] );
        	}
        	db_query( "insert into history (owner,engine,title,blog_id,post_id,content_type,datepost,logs) values('{$blog['owner']}','{$blog['engine']}','{$contents['title']}','{$blog['id']}','{$contents['post_id']}','{$contents['type']}',UNIX_TIMESTAMP(),'{$b['link']}')" );
        	if ( $bookmark == "yes" )
        	{
            	echo "\nBookmark to {$bookmark_profile}.\n";
            	bookmarkall( $b, $bookmark_profile, $$bookmark_mode );
        	}
        	echo "\n\n<strong>Success - [ <a href='j;' onclick=\"window.open('{$blog['blog_url']}');\">View</a> ]</strong>";
    	}
    	$html = ob_get_contents( );
    	$html = ereg_replace( "\n", "<br>", $html );
    	ob_end_clean( );
    	echo $html;
    	echo "\t\t</td></tr>\r\n";
	}
	else if ( $command == "Add to Queued" )
	{
    	echo "\t  <tr valign=\"top\">\r\n  	<td><p class=\"style29\">";
    	echo $command;
    	echo " Results</p>\r\n\t";
    	if ( $title == "" )
    	{
        	$title = "Untitle";
    	}
    	db_query( "insert into mcontent (blog_id,owner,title,content,category) values('{$id}','{$_SESSION['user']}','{$title}','{$content}','{$category}')" );
    	echo "<strong>{$title} has been add to queued.</strong>";
    	echo "\t\t\t</td></tr>\r\n\t\t\t";
	}
	echo "  </table>\r\n";
}
echo "<s";
echo "pan class=\"style28\">Content in Queued</span><br />\r\n";
$rs = db_query( "select * from mcontent where blog_id='{$id}' and owner='{$_SESSION['user']}'" );
if ( 0 < mysql_num_rows( $rs ) )
{
	echo "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"./?extmodule=manualcontent&id=";
	echo $id;
	echo "\">\r\n  <table width=\"95%\" border=\"0\" cellspacing=\"5\" cellpadding=\"5\">\r\n	";
	while ( $c = mysql_fetch_array( $rs ) )
	{
    	echo "	<tr>\r\n  	<td width=\"18%\"><div align=\"center\">\r\n    	<label></label>\r\n    	<div align=\"right\">\r\n      	<input type=\"checkbox\" name=\"blog_id[]\" id=\"blog_id[]\" value=\"";
    	echo $c[id];
    	echo "\" />\r\n    	</div>\r\n  	</div>\r\n    	<div align=\"right\"></div><div align=\"right\"></div></td>\r\n  	<td width=\"82%\">";
    	echo $c[title];
    	echo "</td>\r\n	</tr>\r\n  \r\n	";
	}
	echo "  <tr>\r\n  	<td> </td>\r\n  	<td><input type=\"submit\" name=\"command\" value=\"Delete\" class='buttonblue' id=\"command\" /></td>\r\n	</tr>\r\n  </table>\r\n</form>\r\n";
}
else
{
	echo "<p>No Content in Queued.</p>";
}
?>