<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Hello World as an MT::App CGI</title>
	<atom:link href="http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/</link>
	<description>I&#039;m a sucker for girl groups.</description>
	<lastBuildDate>Fri, 05 Mar 2010 11:05:08 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: 虚拟主机</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-10564</link>
		<dc:creator>虚拟主机</dc:creator>
		<pubDate>Thu, 29 Jun 2006 07:58:06 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-10564</guid>
		<description>&lt;p&gt;Thanks for the information. This is very useful&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for the information. This is very useful</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Ringnalda</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1462</link>
		<dc:creator>Phil Ringnalda</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1462</guid>
		<description>&lt;p&gt;Wonderful! Not that, er, I&#039;ve been too lazy to either figure it out on my own, or even to steal from someone else, you understand. Just, generally speaking, how very nice of you!&lt;/p&gt;

&lt;p&gt;Couple of nits that I would have probably noticed, if I was stealing it for my own use: hello.pm&#039;s missing the &quot;sub &quot; before init, and the tmpl doesn&#039;t need the end tags for body and html, since footer.tmpl already closes them.&lt;/p&gt;

&lt;p&gt;Also, depending on your app, you might want to add script_url =&gt; MT::ConfigMgr-&gt;instance-&gt;AdminScript to %param in hello.pm, so that the &quot;Main menu&quot; and &quot;Logout&quot; links in the header go to mt.cgi, instead of mt-hello.cgi. Since you&#039;re an MT::App, you can certainly handle them, but it looks weird when hours later you are posting an entry through mt-hello.cgi.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Wonderful! Not that, er, I&#8217;ve been too lazy to either figure it out on my own, or even to steal from someone else, you understand. Just, generally speaking, how very nice of you!</p>

<p>Couple of nits that I would have probably noticed, if I was stealing it for my own use: hello.pm&#8217;s missing the &#8220;sub &#8221; before init, and the tmpl doesn&#8217;t need the end tags for body and html, since footer.tmpl already closes them.</p>

<p>Also, depending on your app, you might want to add script_url => MT::ConfigMgr->instance->AdminScript to %param in hello.pm, so that the &#8220;Main menu&#8221; and &#8220;Logout&#8221; links in the header go to mt.cgi, instead of mt-hello.cgi. Since you&#8217;re an MT::App, you can certainly handle them, but it looks weird when hours later you are posting an entry through mt-hello.cgi.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: PapaScott</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1463</link>
		<dc:creator>PapaScott</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1463</guid>
		<description>&lt;p&gt;Thanks for the nits, Phil! I&#039;ll incorporate your changes.&lt;/p&gt;

&lt;p&gt;As for the script_url, I went back to Notifier to see how Chad  did it, and saw that he defined a sub uri that does the same thing.  It has the advantage that it gets picked by anything else we might add to &amp;app-&gt;add_methods. Now that I know what it&#039;s for, I&#039;ll put it back in.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for the nits, Phil! I&#8217;ll incorporate your changes.</p>

<p>As for the script_url, I went back to Notifier to see how Chad  did it, and saw that he defined a sub uri that does the same thing.  It has the advantage that it gets picked by anything else we might add to &amp;app->add_methods. Now that I know what it&#8217;s for, I&#8217;ll put it back in.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: jayseae</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1464</link>
		<dc:creator>jayseae</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1464</guid>
		<description>&lt;p&gt;One thing you may want to consider:  The uri subroutine that I wrote in MT-Notifier does do what you expect, in that it overrides the default one that uses the calling script name (mt-hello.cgi in your case).&lt;/p&gt;

&lt;p&gt;However, in at least one case, you&#039;ll actually want to use your script name instead.  Otherwise it will end up calling mt.cgi, which isn&#039;t what you want.&lt;/p&gt;

&lt;p&gt;This case occurs when you have not yet logged into your MT install and want to go directly to mt-hello.cgi.  When that is the case, you&#039;ll notice that the redirect info will send you back to mt.cgi, which means you&#039;ll need to select your script again.  Having logged in, it should work that time.  But it&#039;s an extra step, and oh how I hate extra steps.  :)&lt;/p&gt;

&lt;p&gt;For this particular plugin, it may not matter.  For MT-Notifier, I like to be able to go straight there, instead of having to go back to the menu and select to go to MT-Notifier again - I already told it that!&lt;/p&gt;

&lt;p&gt;Here&#039;s that code (contents of sub uri):&lt;/p&gt;

&lt;p&gt;$&lt;em&gt;[0]-&gt;path . ($&lt;/em&gt;[0]-&gt;{author} ? MT::ConfigMgr-&gt;instance-&gt;AdminScript : $_[0]-&gt;script);&lt;/p&gt;

&lt;p&gt;To get around this particular case, I use a condition in that statement.  Specifically, I checked to see if the author is set.  If it is, it means someone is logged in.  In that case, use the AdminScript.  If it is not set, then someone is not logged in, which means I&#039;d actually want to use my script for the redirect.  Hope that makes sense to everyone.  :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>One thing you may want to consider:  The uri subroutine that I wrote in MT-Notifier does do what you expect, in that it overrides the default one that uses the calling script name (mt-hello.cgi in your case).</p>

<p>However, in at least one case, you&#8217;ll actually want to use your script name instead.  Otherwise it will end up calling mt.cgi, which isn&#8217;t what you want.</p>

<p>This case occurs when you have not yet logged into your MT install and want to go directly to mt-hello.cgi.  When that is the case, you&#8217;ll notice that the redirect info will send you back to mt.cgi, which means you&#8217;ll need to select your script again.  Having logged in, it should work that time.  But it&#8217;s an extra step, and oh how I hate extra steps.  <img src='http://www.papascott.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p>For this particular plugin, it may not matter.  For MT-Notifier, I like to be able to go straight there, instead of having to go back to the menu and select to go to MT-Notifier again &#8211; I already told it that!</p>

<p>Here&#8217;s that code (contents of sub uri):</p>

<p>$<em>[0]->path . ($</em>[0]->{author} ? MT::ConfigMgr->instance->AdminScript : $_[0]->script);</p>

<p>To get around this particular case, I use a condition in that statement.  Specifically, I checked to see if the author is set.  If it is, it means someone is logged in.  In that case, use the AdminScript.  If it is not set, then someone is not logged in, which means I&#8217;d actually want to use my script for the redirect.  Hope that makes sense to everyone.  <img src='http://www.papascott.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Dan S.</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1465</link>
		<dc:creator>Dan S.</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1465</guid>
		<description>&lt;p&gt;My solution to the login redirect problem was a hack of the __script parameter: $app-&gt;{__script} = $app-&gt;{cfg}-&gt;AdminScript;  Then I created separate routines and template variables for the path to my CGI (as opposed to the path to mt.cgi), and used those when appropriate in my templates.  This allowed me to include the blog-specific MT sidebar in my UI (because my config was blog-specific, so it ought to look like part of the blog-specific interface).&lt;/p&gt;

&lt;p&gt;Also, I believe config_link =&gt; &#039;../mt-hello.cgi&#039; in hello.pl will cause the config link to appear as &quot;http://yoursite/mt/plugins/../mt-hello.cgi&quot;, which ought not to work for most web servers.  (If it does work, it&#039;s a security hazard, because then people can reach around your filesystem for files.)  Because of this limitation, MT 3.01 requires that CGIs be under the plugins/ directory somewhere, which means hard-coding a relative path to the MT root directory (which means the plugins/ directory must be in the MT app root, which I consider undesirable).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>My solution to the login redirect problem was a hack of the __script parameter: $app->{__script} = $app->{cfg}->AdminScript;  Then I created separate routines and template variables for the path to my CGI (as opposed to the path to mt.cgi), and used those when appropriate in my templates.  This allowed me to include the blog-specific MT sidebar in my UI (because my config was blog-specific, so it ought to look like part of the blog-specific interface).</p>

<p>Also, I believe config_link => &#8216;../mt-hello.cgi&#8217; in hello.pl will cause the config link to appear as &#8220;http://yoursite/mt/plugins/../mt-hello.cgi&#8221;, which ought not to work for most web servers.  (If it does work, it&#8217;s a security hazard, because then people can reach around your filesystem for files.)  Because of this limitation, MT 3.01 requires that CGIs be under the plugins/ directory somewhere, which means hard-coding a relative path to the MT root directory (which means the plugins/ directory must be in the MT app root, which I consider undesirable).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: PapaScott</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1466</link>
		<dc:creator>PapaScott</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1466</guid>
		<description>&lt;p&gt;I did test the hello plugin with MT 3.01 (Apache 1.3x, FreeBSD), and the &#039;../mt-hello.cgi&#039; notation worked just fine. At least for Apache, the double-dot notation is not a security risk, since it will not break out of your DocumentRoot no matter how many double-dots you try to insert.&lt;/p&gt;

&lt;p&gt;That said, the idea of putting all plugin files, be they CGIs, libraries, or whatever, under plugins/ is appealing to me, as opposed to plastering files all over the MT directory structure. Make the plugin author work to find the files he needs, not the poor end-user!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I did test the hello plugin with MT 3.01 (Apache 1.3x, FreeBSD), and the &#8216;../mt-hello.cgi&#8217; notation worked just fine. At least for Apache, the double-dot notation is not a security risk, since it will not break out of your DocumentRoot no matter how many double-dots you try to insert.</p>

<p>That said, the idea of putting all plugin files, be they CGIs, libraries, or whatever, under plugins/ is appealing to me, as opposed to plastering files all over the MT directory structure. Make the plugin author work to find the files he needs, not the poor end-user!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Dan S.</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1467</link>
		<dc:creator>Dan S.</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1467</guid>
		<description>&lt;p&gt;I&#039;m glad to hear Apache does the useful thing with the double-dot.  I&#039;ll have to figure out why I couldn&#039;t get it to work in my set-up.&lt;/p&gt;

&lt;p&gt;As for putting everything in the plugins directory, my point is that nothing should be in a web servable directory that isn&#039;t intended to be served.  Without special configuration, most web hosting installations would serve *.pl files as if they were text files, and exposing their contents is a potential security risk.  A site admin who knew what they were doing could explicitly configure their web server to prevent plugin source files from being served, but for most users, we have to assume they won&#039;t or can&#039;t take such precautions.  Most people won&#039;t know that these files are servable, and not knowing could lead to problems.  I can imagine a developer building a site with custom plugins that access a database, with the database login and password embedded in the *.pl file.  In general, it&#039;s just an unnecessary security burden that the admin needs to keep track of, and I believe it could be avoided.&lt;/p&gt;

&lt;p&gt;The same could be said about mt.cfg, but I&#039;m willing to concede that because it will always be just the one file, the instructions to secure it are in the MT installation instructions, and most alternatives would be complicated and platform specific.  For my site, I also lock out the template directories, lib, extlib, and anything else that I don&#039;t explicitly want dished up by the server.&lt;/p&gt;

&lt;p&gt;I agree that it&#039;s appealing to package and distribute plugins with instructions that just say, &quot;Put all this in the plugins directory.&quot;  (And similarly as an admin, so plugin files are scattered everywhere.)  I just want the option for admins to be able to move the not-to-be-served stuff, so as an admin I have the choice, and as a plugin developer I don&#039;t have to worry about it.&lt;/p&gt;

&lt;p&gt;My apologies for getting off topic. :)  Thanks for the hello-world MT::App, this will be useful to many.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad to hear Apache does the useful thing with the double-dot.  I&#8217;ll have to figure out why I couldn&#8217;t get it to work in my set-up.</p>

<p>As for putting everything in the plugins directory, my point is that nothing should be in a web servable directory that isn&#8217;t intended to be served.  Without special configuration, most web hosting installations would serve *.pl files as if they were text files, and exposing their contents is a potential security risk.  A site admin who knew what they were doing could explicitly configure their web server to prevent plugin source files from being served, but for most users, we have to assume they won&#8217;t or can&#8217;t take such precautions.  Most people won&#8217;t know that these files are servable, and not knowing could lead to problems.  I can imagine a developer building a site with custom plugins that access a database, with the database login and password embedded in the *.pl file.  In general, it&#8217;s just an unnecessary security burden that the admin needs to keep track of, and I believe it could be avoided.</p>

<p>The same could be said about mt.cfg, but I&#8217;m willing to concede that because it will always be just the one file, the instructions to secure it are in the MT installation instructions, and most alternatives would be complicated and platform specific.  For my site, I also lock out the template directories, lib, extlib, and anything else that I don&#8217;t explicitly want dished up by the server.</p>

<p>I agree that it&#8217;s appealing to package and distribute plugins with instructions that just say, &#8220;Put all this in the plugins directory.&#8221;  (And similarly as an admin, so plugin files are scattered everywhere.)  I just want the option for admins to be able to move the not-to-be-served stuff, so as an admin I have the choice, and as a plugin developer I don&#8217;t have to worry about it.</p>

<p>My apologies for getting off topic. <img src='http://www.papascott.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Thanks for the hello-world MT::App, this will be useful to many.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: David Jacobs</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1468</link>
		<dc:creator>David Jacobs</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1468</guid>
		<description>&lt;p&gt;Line 5 of mt-hello.cgi should read:
  if ($0 =~ m!(.*[/&#93;)!) {&lt;/p&gt;

&lt;p&gt;instead of
  if ($0 =~ m!(.*[/&#93;)!) {&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Line 5 of mt-hello.cgi should read:
  if ($0 =~ m!(.*[/&#93;)!) {</p>

<p>instead of
  if ($0 =~ m!(.*[/&#93;)!) {</p>]]></content:encoded>
	</item>
	<item>
		<title>By: David Jacobs</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1469</link>
		<dc:creator>David Jacobs</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1469</guid>
		<description>&lt;p&gt;One more typo: 
print &quot;Content-Type: text/htmlnn&quot;;&lt;/p&gt;

&lt;p&gt;should be \n\n ...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>One more typo: 
print &#8220;Content-Type: text/htmlnn&#8221;;</p>

<p>should be \n\n &#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Movalog Sideblog</title>
		<link>http://www.papascott.de/archives/2004/08/12/hello-world-as-an-mtapp-cgi/comment-page-1/#comment-1470</link>
		<dc:creator>Movalog Sideblog</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://wp.papascott.de/wordpress/?p=2002#comment-1470</guid>
		<description>&lt;p&gt;&lt;strong&gt;Hello World as an MT::App CGI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PapaScott » Hello World as an MT::App CGI...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><strong>Hello World as an MT::App CGI</strong></p>

<p>PapaScott » Hello World as an MT::App CGI&#8230;</p>]]></content:encoded>
	</item>
</channel>
</rss>
