Source for file online_links.php
Documentation is available at online_links.php
<?php // $Id: online_links.php 13296 2007-09-27 02:19:40Z yannoo $
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program 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.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
==============================================================================
* Management of links. When we click on a link, it opens in the right frame
* @author Olivier Brouckaert
==============================================================================
// name of the language file that needs to be included
include('../inc/global.inc.php');
include_once(api_get_path(LIBRARY_PATH). 'fileUpload.lib.php');
$query= "SELECT username FROM $tbl_user WHERE user_id='". $_user['user_id']. "'";
$isAllowed= (empty($pseudoUser) || !$_cid)? false: true;
$isMaster= $is_courseAdmin? true: false;
if(!$isAllowed || !$isMaster)
$link_file= $_FILES['link_file'];
$link_name= $link_file['name'];
$extension= explode('.',$link_file['name']);
$extension= $extension[sizeof($extension)- 1];
$link_file['name']= str_replace('.'. $extension,$suffix. '.'. $extension,$link_file['name']);
$link_url= str_replace($_configuration['root_sys'],$_configuration['root_web'],$doc_path). $link_file['name'];
if(!empty($link_name) && !empty($link_url))
$link_url= 'http://'. $link_url;
$query= "UPDATE $tbl_online_link
$query= "INSERT INTO $tbl_online_link (name,url) VALUES('". addslashes($link_name). "','". addslashes($link_url). "')";
$query= "DELETE FROM $tbl_online_link WHERE id='$link'";
$query= "SELECT id,name,url FROM $tbl_online_link ORDER BY name";
if($action == 'edit' && $link == $row['id'])
if($action == 'edit' && empty($link_name))
include('header_frame.inc.php');
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<td width="1%" valign="middle"><a href="online_master.php"><img src="../img/home.gif" border="0" alt="" title=" <?php echo htmlentities(get_lang('Back'),ENT_QUOTES,$charset); ?>"></a></td>
<td width="99%" align="left"> <a href="online_master.php"> <?php echo get_lang('Back'); ?></a></td>
<form method="post" action=" <?php echo api_get_self(); ?>?action= <?php echo $action; ?>&link= <?php echo $link; ?>" enctype="multipart/form-data">
<input type="hidden" name="sent" value="1">
<table border="0" cellpadding="3" cellspacing="0">
<td width="45%"> <?php echo get_lang('LinkName'); ?> :</td>
<td width="55%"><input type="text" name="link_name" size="10" maxlength="50" value=" <?php if($action == 'edit') echo htmlentities($link_name,ENT_QUOTES,$charset); ?>" style="width: 95px;"></td>
<td width="45%"> <?php echo get_lang('LinkURL'); ?> :</td>
<td width="55%"><input type="text" name="link_url" size="10" maxlength="100" value=" <?php if($action == 'edit') echo htmlentities($link_url); else echo 'http://'; ?>" style="width: 95px;"></td>
<td width="45%"> <?php echo get_lang('OrFile'); ?> :</td>
<td width="55%"><input type="file" name="link_file" size="1" value="" style="width: 95px;"></td>
<td colspan="2" align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
foreach($Links as $enreg)
<td width="98%"><a href="online_goto.php?url= <?php echo urlencode($enreg['url']); ?>" target="online_working_area"> <?php echo $enreg['name']; ?></a></td>
<td width="1%" valign="middle"><a href=" <?php echo api_get_self(); ?>?action=edit&link= <?php echo $enreg['id']; ?>"><img src="../img/edit.gif" border="0" alt="" title=" <?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?>"></a></td>
<td width="1%" valign="middle"><a href=" <?php echo api_get_self(); ?>?action=delete&link= <?php echo $enreg['id']; ?>" onclick="javascript:if(!confirm(' <?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)); ?>')) return false;"><img src="../img/delete.gif" border="0" alt="" title=" <?php echo htmlentities(get_lang('Delete'),ENT_QUOTES,$charset); ?>"></a></td>
include('footer_frame.inc.php');
|