Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91505451
LINK_edit.php.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
Mon, Nov 11, 18:06
Size
6 KB
Mime Type
text/html
Expires
Wed, Nov 13, 18:06 (2 d)
Engine
blob
Format
Raw Data
Handle
22273189
Attached To
R3600 invenio-infoscience
LINK_edit.php.wml
View Options
<?
/*********************************************************************
This file is part of the CERN Document Server Software (CDSware).
Copyright (C) 2002, 2003, 2004, 2005, 2006 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_edit.php (flexElink WI)
// Description: Allows to modify the data of an existing link definition by
// the user.
// POST parameters:
// linktype --> (required) Name (id) of the link definition to be modified
// linktype_orig -> (optional) Contains the original name (name in the DB)
// of the link definition which has to be modified. When this
// parameter is set, the update in the DB is done with the
// parameter values received by the script.
// 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 detailed definition display
// Requires: DB, ERROR
// Author: Hector.Sanchez@cern.ch
//==========================================================================
include("localconf.inc.php");
include(DB);
include(ERROR);
include(FUNCTION_LIB);
if((!isset($linktype))||(trim($linktype)==""))
{
print "<b>ERROR</b>: Link type label hasn't been specified!!<hr>";
print "<a align=\"center\" href=\"JavaScript:window.history.go(-1)\">[Go Back]</a>";
exit;
}
if(get_magic_quotes_gpc())
{
$linktype=stripslashes($linktype);
}
$db=mysql_connect( $DB_HOST, $DB_USER, $DB_PASSWD );
mysql_selectdb( $DB_DB );
if(isset($linktype_orig))
{
if(get_magic_quotes_gpc())
{
$linktype_orig=stripslashes($linktype_orig);
}
$linktype=trim(strtoupper($linktype));
$linktype_orig=trim(strtoupper($linktype_orig));
if( !isset($params) )
{
$params="";
}
if(!isset($stype))
{
$stype="EXT";
}
else
{
$stype=strtoupper(trim($stype));
}
if(($stype!="EXT")&&($stype!="INT"))
{
print "Incorrect value for <b>solving type</b>";
print "<hr>";
print "<a href=\"JavaScript:window.history.go(-1)\">[Back]</a>";
exit;
}
if(!isset($bfile))
$bfile="";
if(!isset($burl))
$burl="";
if(!get_magic_quotes_gpc())
{
$stype=addslashes($stype);
$bfile=addslashes($bfile);
$burl=addslashes($burl);
}
$qry="delete from flxLINKTYPEPARAMS
where linktype='$linktype'";
if(!mysql_query($qry))
{
print "Impossible to delete old link params for '$linktype': ".
mysql_error();
print "<hr>";
print "<a href=\"JavaScript:window.history.go(-1)\">[Back]</a>";
mysql_close( $db );
exit;
}
$qry="update flxLINKTYPES
set solvingtype='$stype',
base_file='$bfile',
base_url='$burl'
where linktype='$linktype'";
if(!mysql_query($qry))
{
print "Impossible to update link type '$linktype': ".mysql_error();
print "<hr>";
print "<a href=\"JavaScript:window.history.go(-1)\">[Back]</a>";
mysql_close( $db );
exit;
}
if(trim($params)!="")
{
$params=split(",", $params);
$order=0;
foreach($params as $param)
{
if(trim($param)=="")
continue;
$param=trim(strtoupper($param));
$qry="insert into flxLINKTYPEPARAMS
values('$linktype', '$param', $order)";
$errors="";
if(!mysql_query( $qry ))
{
$errors.="Impossible to insert parameter '$param':<br> ".
mysql_error()."<br><br>";
}
$order++;
}
if($errors!="")
{
print $errors;
print "<hr>";
print "<a href=\"JavaScript:window.history.go(-1)\">[Back]</a>";
mysql_close( $db );
exit;
}
}
header("location: LINK_showone.php?linktype=$linktype");
exit;
}
$qry="select solvingtype, base_file, base_url
from flxLINKTYPES
where linktype='".addslashes($linktype)."'";
$qh=mysql_query($qry);
print "<form action=\"\" method=\"POST\">";
print '<table width="100%" bgcolor="#CCCCCC" border="1">';
print "<tr bgcolor=\"#33CC00\" align=\"center\">";
print "<td colspan=\"2\"><font size=\"6\">Modifying link type '$linktype'</font></td>";
print "</tr>";
list($stype, $bfile, $burl)=mysql_fetch_row($qh);
$qry_par="select pname
from flxLINKTYPEPARAMS
where linktype='".addslashes($linktype)."'
order by ord";
$qh_par=mysql_query($qry_par);
$pars="";
while($row=mysql_fetch_array($qh_par))
{
$pars.=$row[0].",";
}
?>
<tr bgcolor="#FFFFFF">
<td bgcolor="#CCFFCC" width="15%"><b>Parameters</b></td>
<td><input type="text" name="params" value="<?echo $pars;?>" size="70"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#CCFFCC"><b>Solving type</b></td>
<td><select name="stype">
<option value="EXT" <?if($stype=="EXT") echo "selected";?>>
External
</option>
<option value="INT" <?if($stype=="INT") echo "selected";?>>
Internal
</option>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#CCFFCC"><b>Base file path</b></td>
<td><input type="text" name="bfile" size="100" value="<?echo $bfile;?>"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#CCFFCC"><b>Base url</b></td>
<td><input type="text" name="burl" size="100" value="<?echo $burl;?>"></td>
</tr>
<tr align="center">
<td colspan="2">
<input type="button" value="CANCEL" onClick="JavaScript:window.history.go(-1)">
<input class="formbutton" type="submit" value="UPDATE">
<input type="hidden" name="linktype" value="<?echo $linktype;?>">
<input type="hidden" name="linktype_orig" value="<?echo $linktype;?>">
</td>
</tr>
</table>
</form>
<?
mysql_close( $db );
?>
Event Timeline
Log In to Comment