Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104625399
goto.shtml.wml
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Mar 11, 00:27
Size
2 KB
Mime Type
text/x-c
Expires
Thu, Mar 13, 00:27 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24825281
Attached To
R3600 invenio-infoscience
goto.shtml.wml
View Options
## $Id$
## Purpose: go to a collection page (given in the `c' argument).
## Input:
## c = collection name (e.g. "ATLAS Notes")
## Output: HTTP redirect to the given page
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## read config variables:
#include "config.wml"
#include "configbis.wml"
<?
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
</protect>
## connect to mysql database:
$dbh = mysql_pconnect('<DBHOST>','<DBUSER>','<DBPASS>')
or die("Cannot connect to SQL server." .
"Try <em>reload</em> of the page.");
mysql_select_db("<DBNAME>")
or die("Cannot choose <DBNAME> database on <DBHOST>." .
"Try <em>reload</em> of the page.");
## check whether we are not in the home collection:
if ($c == "<CDSNAME>") {
$url = "<WEBURL>";
Header("Location: $url");
exit;
}
## find out whether 'c' is really a collection:
$query = "SELECT id FROM collection WHERE name='$c'";
$res = mysql_query($query, $dbh);
if ($row = mysql_fetch_row($res)) {
$c_id = $row[0];
} else {
# no it is not a good name
print "Sorry, collection <em>$c</em> was not found. Go to the <a href=\"<WEBURL>\"><CDSNAME></a>.";
}
mysql_free_result($res);
## find out about ancestors:
while ($c_id) {
$query = "SELECT cc.id_dad, c.name FROM collection_collection AS cc, collection AS c " .
" WHERE cc.id_son='$c_id' AND c.id=cc.id_dad ORDER BY cc.score DESC LIMIT 1";
$res = mysql_query($query, $dbh);
if ($row = mysql_fetch_row($res)) {
if ($row[0]>1) {
$ancestors[] = $row[1];
}
$c_id = $row[0];
} else {
break;
}
mysql_free_result($res);
}
## construct path:
for ($i=count($ancestors); $i>=0; $i--) {
$path .= $ancestors[$i] . "/";
}
$path .= $c . "/";
## replace special chars:
$path=ereg_replace(" ", "_", $path);
$path=ereg_replace("&","and",$path);
$path=ereg_replace("\(","",$path);
$path=ereg_replace("\)","",$path);
## okay, redirect there:
$url = "<WEBURL>/$path";
Header("Location: $url");
exit;
?>
Event Timeline
Log In to Comment