예제 #1
0
* - It calls the event function
* - It redirects the user to the linked page
*
* Need the liens.id, user.user_id et cours.code when called
* ?link_id=$myrow[0]&link_url=$myrow[1]
* url is given to avoid a new select
*
* @author Thomas Depraetere, Hugues Peeters, Christophe Gesch� - original versions
* @package chamilo.link
*/
/*	INIT SECTION */
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'link.lib.php';
$this_section = SECTION_COURSES;
$linkId = intval($_GET['link_id']);
$linkInfo = get_link_info($linkId);
if ($linkInfo['target'] == '_in_header') {
    $tpl = $app['template'];
    $url = $linkInfo['url'];
    $interbreadcrumb[] = array('url' => 'link.php', 'name' => get_lang('Links'));
    $frame = '<iframe name="page" onload="javascript:resizeIframe(this);" style="width:100%;height:500px" frameBorder=0px; src="' . $url . '">
             </iframe>';
    $js = "<script>\n    function resizeIframe(obj) {\n        /*var body = obj.contentWindow.document.body;\n        var height =\$(obj, top.document).height();\n        console.log(height);\n        console.log(jQuery('iframe',top.document).height());\n        obj.style.height = height;*/\n    }\n    </script>";
    $tpl->assign('content', $js . $frame);
    $tpl->display_one_col_template();
} else {
    $link_url = html_entity_decode(Security::remove_XSS($_GET['link_url']));
    // Launch event
    event_link($linkId);
    header("Cache-Control: no-store, no-cache, must-revalidate");
    // HTTP/1.1
예제 #2
0
if (isset($action)) {
    $sess->unregister("action");
} else {
    $action = $HTTP_POST_VARS['action'] != "" ? $HTTP_POST_VARS['action'] : $HTTP_GET_VARS['action'];
}
if (isset($formdata['action'])) {
    $action = $formdata['action'];
    $title = $formdata['title'];
    $description = $formdata['description'];
    $url = $formdata['url'];
}
$caps = get_caps($perm);
//used to read the superuser-capability of users with perm->have-perm("admin");
$mytrail = get_node_info($PATH_INFO);
if (isset($i)) {
    $thislink = get_link_info($i);
}
if ($mytrail == -1) {
    $mytrail = get_node_info($PATH_INFO . "?");
}
$trailperms = relevant_perms($mytrail, $auth->auth["uid"], $caps);
if ($action == "langanswer") {
    $what = "pass";
}
if ($action == "add") {
    $what = "add";
}
if ($action == "") {
    $what = "pass";
}
if ($action == "edit") {
예제 #3
0
 // Displaying the correct title and the form for adding a category or link. This is only shown when nothing
 // has been submitted yet, hence !isset($submit_link)
 if (($_GET['action'] == 'addlink' || $_GET['action'] == 'editlink') && empty($_POST['submitLink'])) {
     if ($category == '') {
         $category = 0;
     }
     echo '<form class="form-horizontal" method="post" action="' . api_get_self() . '?action=' . Security::remove_XSS($_GET['action']) . '&amp;urlview=' . Security::remove_XSS($urlview) . '">';
     if ($_GET['action'] == 'addlink') {
         echo '<legend>' . get_lang('LinkAdd') . '</legend>';
     } else {
         echo '<legend>' . get_lang('LinkMod') . '</legend>';
     }
     echo '<input type="hidden" name="sec_token" value="' . $token . '" />';
     if ($_GET['action'] == 'editlink') {
         $clean_link_id = intval($_GET['id']);
         $link_info = get_link_info($_GET['id']);
         if ($link_info) {
             $urllink = $link_info['url'];
             $title = $link_info['title'];
             $description = $link_info['description'];
             $category = $link_info['category_id'];
             $onhomepage = '';
             if ($link_info['on_homepage'] != 0) {
                 $onhomepage = 'checked';
             }
             $target_link = $link_info['target'];
         }
         echo '<input type="hidden" name="id" value="' . $clean_link_id . '" />';
     } else {
         $target_link = "_blank";
     }
예제 #4
0
파일: goto.php 프로젝트: pilif/linktrail
<?php

if (!defined("TRAILS_INC")) {
    include "dbapi/trails.inc";
}
if (!defined("LAY_TRAIL_INC")) {
    include "layout/lay_trail.inc";
}
include "template.inc";
$id = substr($PATH_INFO, 1);
$info = get_link_info($id);
if ($info == "-1") {
    Header("Location: /");
    exit;
}
print print_redirecting($info['url'], $info['title']);
?>