Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93549174
LINK_add.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
Fri, Nov 29, 15:53
Size
3 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 15:53 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22661926
Attached To
R3600 invenio-infoscience
LINK_add.shtml.wml
View Options
<?
/*********************************************************************
This file is part of the CERN Document Server Software (CDSware).
Copyright (C) 2002 CERN.
1211 Geneva 23 - Switzerland
<cds.support@cern.ch>
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
*********************************************************************/
//==========================================================================
// File: LINK_add.shtml (flexElink WI)
// Description: Adds a new link definition to the DB.
// POST parameters:
// linktype --> (required) Name (id) of the link definition to be added
// params ----> (optional) List of parameters that the link will accept;
// they have to be separated with "," and the order in which they
// are specified is the order the values will have to be passed
// when solving the link
// stype ----> (optional, allowed values: EXT, INT) Link solving type; if
// it isn't specified is put to the default value (EXT)
// bfile ----> (optional) Base file path for internal link solving
// burl -----> (optional) Base url path for internal link solving
// Notes: If the format is succesfully added to the DB it redirects the current
// browser to the link display list
// Requires: DB, ERROR
// Author: Hector.Sanchez@cern.ch
//==========================================================================
include("localconf.inc.shtml");
include(DB);
include(ERROR);
if( (!isset($linktype)) or (trim($linktype)=="") )
{
errorpage("<b>Link Type</b> hasn't been specified");
exit;
}
$linktype=trim(strtoupper($linktype));
if( !isset($params) )
{
$params="";
}
if(!isset($stype))
{
$stype="EXT";
}
else
{
$stype=strtoupper(trim($stype));
}
if(($stype!="EXT")&&($stype!="INT"))
{
errorpage("Incorrect value for <b>solving type</b>");
exit;
}
if(!isset($bfile))
$bfile="";
if(!isset($burl))
$burl="";
if(!get_magic_quotes_gpc())
{
$stype=addslashes($stype);
$bfile=addslashes($bfile);
$burl=addslashes($burl);
}
$db=mysql_connect( $DB_HOST, $DB_USER, $DB_PASSWD );
mysql_selectdb( $DB_DB );
$qry="insert into flxLINKTYPES(linktype, check_exists,
solvingtype, base_file, base_url)
values('$linktype', '$check', '$stype', '$bfile', '$burl')";
if(!mysql_query( $qry ))
{
errorpage("Impossible to insert new type:<br> ".mysql_error());
mysql_close( $db );
exit;
}
if(trim($params)!="")
{
$params=split(",", $params);
$order=0;
foreach($params as $param)
{
$param=trim(strtoupper($param));
$qry="insert into flxLINKTYPEPARAMS values('$linktype', '$param', $order)";
if(!mysql_query( $qry ))
{
errorpage("Impossible to insert parameter '$param':<br> ".mysql_error());
mysql_close( $db );
exit;
}
$order++;
}
}
mysql_close( $db );
header("location: LINK_display.shtml");
?>
Event Timeline
Log In to Comment