I'm using this line in searchengine.php
mysql_query("INSERT INTO wsearch (usersearch) VALUES ('".$_REQUEST['search']."')") or die(mysql_error());
however, I'm confused as where to put it, either i get just search querys and not the "go"s or I get a No Database Selected error.
-Moonlight Embrace
On Sep 24, 2004, at 1:08 PM, Moonlight Embrace wrote:
I'm using this line in searchengine.php
mysql_query("INSERT INTO wsearch (usersearch) VALUES ('".$_REQUEST['search']."')") or die(mysql_error());
however, I'm confused as where to put it, either i get just search querys and not the "go"s or I get a No Database Selected error.
Rather than mysql_query directly, try the wfQuery() wrapper function; this will make sure the database connection is set up before sending the query.
Also, as written you're open to SQL injection attacks. Never stick strings directly into SQL; wrap it in an escaping function (eg the wfStrencode() wrapper function).
-- brion vibber (brion @ pobox.com)
I propose that if a link like [[foo]] is processed for output, and article foo doesn't exist but category foo does, then the link should be treated like [[:Category:foo|foo]]. The former is a lot easier to write.
This will make it hard to create an article foo if category foo already exists. I'm not sure that's a bad thing. If someone does manage to do that, then all [[foo]] links will switch from category to article. But these are the only drawbacks I can see.
The code is very simple. In the place in Skin.php:makeLinkObj() where it checks if the article ID is 0 and makes a broken link, use this code instead:
$aid = $nt->getArticleID() ; if ( 0 == $aid ) { #New stuff starts here... $ttext = $nt->getText() ; $cname = Namespace::getCanonicalName(Namespace::getCategory()); $cnt = Title::newFromText ( $cname.":".$ttext ) ; if (0 == $cnt->getArticleID()) { $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix ); } else { $retVal = $this->makeKnownLinkObj( $cnt, $text, $query, $trail, $prefix ); } else { #...
Is this the right place to propose this kind of change?
Chris
On Mon, 27 Sep 2004 00:21:14 -0400, Chris Phoenix cphoenix@crnano.org wrote:
I propose that if a link like [[foo]] is processed for output, and article foo doesn't exist but category foo does, then the link should be treated like [[:Category:foo|foo]]. The former is a lot easier to write.
This will make it hard to create an article foo if category foo already exists. I'm not sure that's a bad thing. If someone does manage to do that, then all [[foo]] links will switch from category to article. But these are the only drawbacks I can see.
I think this would be a *very* bad idea; categories are often named very similarly to valid articles, and while a policy could be made of not doing so ([[Category:History topics]] not [[Category:History]]; [[Category:Types of toy]] not [[Category:Toys]]) this seems like a rather dubious thing to enshrine in the software. Having links that magically change target (and thus don't show up as non-existent) would *only* be a good idea if the plain target was *never* going to be a desired name. I don't think [[Category:Foo]] vs [[Foo]] gives such a guarantee.
I guess it depends on whether you want categories to be second-class citizens, or whether you want to build your site around them. For my site, I'm choosing the second option. For a site that already has lots of articles and categories with the same name, it may not be a good option.
The plain target might be a desired name, but it would not be an accessible name. Once the category was created, the only way to create the article would be hand-editing a URL. And in fact, even that would be easy to prevent.
I'm not sure it's good to have articles and categories with the same name anyway. It'd be easy for an author to lose track of which one they were intending to point to. I think I've just convinced myself that I should disallow articles and categories with the same name, period. And then there's no reason not to use the [[foo]] syntax for both.
So I'll withdraw the proposal qua proposal, but I still think it's cool for what I'm doing.
Chris
Rowan Collins wrote:
On Mon, 27 Sep 2004 00:21:14 -0400, Chris Phoenix cphoenix@crnano.org wrote:
I propose that if a link like [[foo]] is processed for output, and article foo doesn't exist but category foo does, then the link should be treated like [[:Category:foo|foo]]. The former is a lot easier to write.
This will make it hard to create an article foo if category foo already exists. I'm not sure that's a bad thing. If someone does manage to do that, then all [[foo]] links will switch from category to article. But these are the only drawbacks I can see.
I think this would be a *very* bad idea; categories are often named very similarly to valid articles, and while a policy could be made of not doing so ([[Category:History topics]] not [[Category:History]]; [[Category:Types of toy]] not [[Category:Toys]]) this seems like a rather dubious thing to enshrine in the software. Having links that magically change target (and thus don't show up as non-existent) would *only* be a good idea if the plain target was *never* going to be a desired name. I don't think [[Category:Foo]] vs [[Foo]] gives such a guarantee.
mediawiki-l@lists.wikimedia.org