Timwi wrote:
Jens Frank wrote:
There are several category names with a / in some
languages:
It seems that the pipe ("|") character is disallowed in our article
titles (and hence, in categories too), but allowed in URLs (I couldn't
find the relevant RfC on this for definite confirmation; can someone
find it?). How about we use that instead?
Actually, I have a better idea now. How about two slashes (//)? Then we
can have something like "Category:9/11//People" to have the intersection
of Category:9/11 and Category:People.
Timwi
Index: includes/Parser.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Parser.php,v
retrieving revision 1.135
diff -u -r1.135 Parser.php
--- includes/Parser.php 15 May 2004 00:29:07 -0000 1.135
+++ includes/Parser.php 3 Jul 2004 16:14:36 -0000
@@ -318,7 +318,25 @@
# FIXME: add limits
$t = wfStrencode( $this->mTitle->getDBKey() );
- $sql = "SELECT DISTINCT cur_title,cur_namespace FROM
cur,categorylinks WHERE cl_to='$t' AND cl_from=cur_id ORDER BY cl_sortkey" ;
+ $t = preg_replace("'///+'","//",$t);
+ if(strchr($t,"//")) {
+ $ta = explode("//",$t);
+ $tt = "cur c";
+ $tw = "";
+
+ $i = 0;
+ foreach($ta as $v) {
+ $tt .= ", categorylinks cl$i";
+ if ($tw != "") { $tw .= " AND "; }
+ $tw .= "cl$i.cl_to='$v' AND cl$i.cl_from=c.cur_id";
+ $i++;
+ }
+ $sql = "SELECT DISTINCT c.cur_title, c.cur_namespace FROM $tt " .
+ " WHERE $tw ORDER BY cl0.cl_sortkey";
+ } else {
+ $sql = "SELECT DISTINCT c.cur_title, c.cur_namespace FROM cur c,
categorylinks cl " .
+ " WHERE cl.cl_to='$t' AND cl.cl_from=c.cur_id ORDER BY
cl.cl_sortkey" ;
+ }
$res = wfQuery ( $sql, DB_READ ) ;
while ( $x = wfFetchObject ( $res ) ) $data[] = $x ;