Anne-Lise Lambin 12 年之前
父节点
当前提交
eb71c6bb5c

二进制
apple-touch-icon-114x114-precomposed.png


二进制
apple-touch-icon-57x57-precomposed.png


二进制
apple-touch-icon-72x72-precomposed.png


二进制
apple-touch-icon-precomposed.png


+ 1 - 1
main/forum/forumconfig.inc.php

@@ -42,7 +42,7 @@ define('TOOL_FORUM_THREAD_QUALIFY','forum_thread_qualify');
 // if this setting is true then an I-frame will be displayed when replying
 $forum_setting['show_thread_iframe_on_reply']=true;
 // if this setting is true then students and teachers can check a checkbox so that they receive a mail when somebody replies to the thread
-$forum_setting['allow_post_notificiation']=true;
+$forum_setting['allow_post_notification']=true;
 // when this setting is true then the course admin can post threads that are important. These posts remain on top all the time (until made unsticky)
 // these special posts are indicated with a special icon also
 $forum_setting['allow_sticky']=true;

文件差异内容过多而无法显示
+ 162 - 156
main/forum/forumfunction.inc.php


+ 1 - 1
main/forum/newthread.php

@@ -26,7 +26,7 @@
 use \ChamiloSession as Session;
 
 // Language file that need to be included.
-$language_file = array('forum', 'document');
+$language_file = array('forum', 'document', 'gradebook');
 
 // Including the global initialization file.
 require_once '../inc/global.inc.php';

+ 1 - 1
main/forum/viewpost.inc.php

@@ -24,7 +24,7 @@ if (isset($rows)) {
         if ($counter == 1) {
             echo Display::page_subheader($name);
         }
-        
+
         echo "<div ".$style."><table class=\"data_table\">";
         // the style depends on the status of the message: approved or not
         //echo 'dd'.$row['status'];

+ 24 - 22
main/forum/viewthread_flat.inc.php

@@ -17,10 +17,10 @@ if (isset($current_thread['thread_id'])){
 
     $clean_forum_id  = intval($_GET['forum']);
     $clean_thread_id = intval($_GET['thread']);
-    $locked = api_resource_is_locked_by_gradebook($clean_thread_id, LINK_FORUM_THREAD);   
-    
+    $locked = api_resource_is_locked_by_gradebook($clean_thread_id, LINK_FORUM_THREAD);
+
     foreach ($rows as $row) {
-        
+
         echo '<table width="100%" class="forum_table" cellspacing="5" border="0">';
         // the style depends on the status of the message: approved or not
         if ($row['visible']=='0') {
@@ -34,14 +34,14 @@ if (isset($current_thread['thread_id'])){
         }
         echo "<tr>";
         echo "<td rowspan=\"3\" class=\"$leftclass\">";
-        
+
         if ($row['user_id']=='0') {
             $name = prepare4display($row['poster_name']);
         } else {
             $name = api_get_person_name($row['firstname'], $row['lastname']);
         }
         $username = sprintf(get_lang('LoginX'), $row['username']);
-        
+
         if ($origin!='learnpath') {
             if (api_get_course_setting('allow_user_image_forum')) {
                 echo '<br />'.display_user_image($row['user_id'],$name).'<br />';
@@ -52,7 +52,7 @@ if (isset($current_thread['thread_id'])){
         }
 
         $group_id = api_get_group_id();
-        
+
         echo api_convert_and_format_date($row['post_date']).'<br /><br />';
         // get attach id
         $attachment_list=get_attachment($row['post_id']);
@@ -84,19 +84,19 @@ if (isset($current_thread['thread_id'])){
 
         $user_status = api_get_status_of_user_in_course($row['user_id'], api_get_course_id());
         $current_qualify_thread = show_qualify('1', $row['poster_id'],$_GET['thread']);
-        
+
         if (api_is_allowed_to_edit(null,true) && $origin != 'learnpath') {
             $my_forum_id = $clean_forum_id;
-            if (isset($_GET['gradebook'])) {            
+            if (isset($_GET['gradebook'])) {
                 $info_thread = get_thread_information($clean_thread_id);
                 $my_forum_id = $info_thread['forum_id'];
-            }        
-            if ($increment > 0 && $locked == false) {            
+            }
+            if ($increment > 0 && $locked == false) {
                  echo "<a href=\"forumqualify.php?".api_get_cidreq()."&amp;forum=".$my_forum_id."&amp;thread=".$clean_thread_id."&amp;action=list&amp;post=".$row['post_id']."&amp;user=".$row['poster_id']."&amp;user_id=".$row['poster_id']."&amp;origin=".$origin."&amp;idtextqualify=".$current_qualify_thread."&amp;gradebook=".Security::remove_XSS($_GET['gradebook'])."\" >".
                         Display::return_icon('quiz.gif',get_lang('Qualify'))."</a> ";
-            }            
+            }
         }
-        
+
         if (($current_forum_category && $current_forum_category['locked']==0) AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
             if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) {
                 if (!api_is_anonymous() && api_is_allowed_to_session_edit(false,true)) {
@@ -128,38 +128,40 @@ if (isset($current_thread['thread_id'])){
         // The post title
 
         echo "</tr>";
-        
+
         //  The post title
         echo "<tr>";
         echo Display::tag('td', prepare4display($row['post_title']), array('class'=>'forum_message_post_title'));
         echo "</tr>";
-        
+
         // The post message
         echo "<tr>";
-        
+
         // see comments inside forumfunction.inc.php to lower filtering and allow more visual changes
         echo "<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>";
         echo "</tr>";
 
         // The check if there is an attachment
 
-        $attachment_list=get_attachment($row['post_id']);
+        $attachment_list = get_attachment($row['post_id']);
         if (!empty($attachment_list)) {
-            echo '<tr><td height="50%">';
+            echo '<tr><td colspan="2" height="50%">';
             $realname=$attachment_list['path'];
             $user_filename=$attachment_list['filename'];
 
             echo Display::return_icon('attachment.gif',get_lang('Attachment'));
-            echo '<a href="download.php?file=';
-            echo $realname;
-            echo ' "> '.$user_filename.' </a>';
-            echo '<span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>';
+            echo '<a href="download.php?file='.$realname.'"> '.$user_filename.' </a>';
+
             if (($current_forum['allow_edit']==1 AND $row['user_id']==$_user['user_id']) or (api_is_allowed_to_edit(false,true)  && !(api_is_course_coach() && $current_forum['session_id']!=$_SESSION['id_session'])))	{
-            echo '&nbsp;&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.Security::remove_XSS($_GET['origin']).'&amp;action=delete_attach&amp;id_attach='.$attachment_list['id'].'&amp;forum='.$clean_forum_id.'&amp;thread='.$clean_thread_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png',get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a><br />';
+                echo '&nbsp;&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.Security::remove_XSS($_GET['origin']).'&amp;action=delete_attach&amp;id_attach='.$attachment_list['id'].'&amp;forum='.$clean_forum_id.'&amp;thread='.$clean_thread_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png',get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a><br />';
             }
+            echo '<span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>';
             echo '</td></tr>';
         }
 
+
+
+
         // The post has been displayed => it can be removed from the what's new array
         unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
         unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']]);

+ 63 - 0
main/inc/lib/htmlpurifier/library/HTMLPurifier/Filter/AllowIframes.php

@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * Based on: http://stackoverflow.com/questions/4739284/htmlpurifier-iframe-vimeo-and-youtube-video
+ * Iframe filter that does some primitive whitelisting in a somewhat recognizable and tweakable way
+ */
+class HTMLPurifier_Filter_AllowIframes extends HTMLPurifier_Filter
+{
+    public $name = 'AllowIframes';
+
+    /**
+     *
+     * @param string $html
+     * @param HTMLPurifier_Config $config
+     * @param HTMLPurifier_Context $context
+     * @return string
+     */
+    public function preFilter($html, HTMLPurifier_Config $config, HTMLPurifier_Context $context)
+    {
+        $html = preg_replace('#<iframe#i', '<img class="MyIframe"', $html);
+        $html = preg_replace('#</iframe>#i', '</img>', $html);
+        return $html;
+    }
+
+    /**
+     *
+     * @param string $html
+     * @param HTMLPurifier_Config $config
+     * @param HTMLPurifier_Context $context
+     * @return string
+     */
+    public function postFilter($html, HTMLPurifier_Config $config, HTMLPurifier_Context $context)
+    {
+        $post_regex = '#<img class="MyIframe"([^>]+?)>#';
+        return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
+    }
+
+    /**
+     *
+     * @param array $matches
+     * @return string
+     */
+    protected function postFilterCallback($matches)
+    {
+        // Domain Whitelist
+
+        $youTubeMatch       = preg_match('#src="https?://www.youtube(-nocookie)?.com/#i', $matches[1]);
+        $vimeoMatch         = preg_match('#src="http://player.vimeo.com/#i', $matches[1]);
+        $googleMapsMatch    = preg_match('#src="https://maps.google.com/#i', $matches[1]);
+
+        if ($youTubeMatch || $vimeoMatch || $googleMapsMatch) {
+            $extra = ' frameborder="0"';
+            if ($youTubeMatch) {
+                $extra .= ' allowfullscreen';
+            } elseif ($vimeoMatch) {
+                $extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen';
+            }
+            return '<iframe ' . $matches[1] . $extra . '></iframe>';
+        } else {
+            return '';
+        }
+    }
+}

+ 86 - 86
main/inc/lib/link.lib.php

@@ -26,18 +26,18 @@ class Link extends Model {
     var $is_course_model = true;
     var $columns = array('id', 'c_id','url','title','description','category_id', 'display_order', 'on_homepage', 'target', 'session_id');
     var $required = array('url', 'title');
-   
+
     public function __construct() {
         $this->table =  Database::get_course_table(TABLE_LINK);
 	}
-    
+
     public function save($params) {
-        $course_info = api_get_course_info();        
+        $course_info = api_get_course_info();
         $params['session_id'] = api_get_session_id();
         $params['category_id'] = isset($params['category_id']) ? $params['category_id'] : 0;
-        
-	    $id = parent::save($params);        
-	    if (!empty($id)) {	    	
+
+	    $id = parent::save($params);
+	    if (!empty($id)) {
             api_item_property_update($course_info, TOOL_LINK, $id, 'LinkAdded', api_get_user_id());
    		}
    		return $id;
@@ -56,8 +56,8 @@ function addlinkcategory($type) {
 	global $msgErr;
 
 	$ok = true;
-    
-    $course_id = api_get_course_int_id();   
+
+    $course_id = api_get_course_int_id();
 
 	if ($type == 'link') {
 		$tbl_link = Database :: get_course_table(TABLE_LINK);
@@ -68,11 +68,11 @@ function addlinkcategory($type) {
 		$selectcategory   = Security :: remove_XSS($_POST['selectcategory']);
 
 		if ($_POST['onhomepage'] == '') {
-			$onhomepage = 0;			
+			$onhomepage = 0;
 		} else {
-			$onhomepage  = Security :: remove_XSS($_POST['onhomepage']);			
+			$onhomepage  = Security :: remove_XSS($_POST['onhomepage']);
 		}
-        
+
         if (empty($_POST['target_link'])) {
             $target = '_self'; // Default target.
         } else {
@@ -96,7 +96,7 @@ function addlinkcategory($type) {
 		// If the URL is invalid, an error occurs.
 		// Ivan, 13-OCT-2010, Chamilo 1.8.8: Let us still tolerate PHP 5.1.x and avoid a specific bug in filter_var(), see http://bugs.php.net/51192
 		//if (!filter_var($urllink, FILTER_VALIDATE_URL)) {
-		if (!api_valid_url($urllink, true)) { // A check against an absolute URL			
+		if (!api_valid_url($urllink, true)) { // A check against an absolute URL
 			$msgErr = get_lang('GiveURL');
 			Display :: display_error_message(get_lang('GiveURL'));
 			$ok = false;
@@ -109,11 +109,11 @@ function addlinkcategory($type) {
 			$session_id = api_get_session_id();
 
 			$sql = "INSERT INTO " . $tbl_link . " (c_id, url, title, description, category_id, display_order, on_homepage, target, session_id)
-			        VALUES (".$course_id.", '".Database :: escape_string($urllink) . "','" . Database :: escape_string($title) . "','" . Database :: escape_string($description) . "','" .			        
+			        VALUES (".$course_id.", '".Database :: escape_string($urllink) . "','" . Database :: escape_string($title) . "','" . Database :: escape_string($description) . "','" .
 			Database :: escape_string($selectcategory) . "','" . Database :: escape_string($order) . "', '" . Database :: escape_string($onhomepage) . "','" .
 			Database :: escape_string($target) . "','" . Database :: escape_string($session_id) . "')";
-			
-			$catlinkstatus = get_lang('LinkAdded');			
+
+			$catlinkstatus = get_lang('LinkAdded');
 			Database :: query($sql);
 			$link_id = Database :: insert_id();
 
@@ -153,7 +153,7 @@ function addlinkcategory($type) {
 						'link_id' => (int) $link_id
 					),
 					SE_USER => (int) api_get_user_id(),
-					
+
 				);
 				$ic_slide->xapian_data = serialize($xapian_data);
 				$description = $all_specific_terms . ' ' . $description;
@@ -207,7 +207,7 @@ function addlinkcategory($type) {
 			$order = $orderMax +1;
 			$order = intval($order);
 			$session_id = api_get_session_id();
-			$sql = "INSERT INTO ".$tbl_categories." (c_id, category_title, description, display_order, session_id) 
+			$sql = "INSERT INTO ".$tbl_categories." (c_id, category_title, description, display_order, session_id)
 			        VALUES (".$course_id.", '" .Database::escape_string($category_title) . "', '" . Database::escape_string($description) . "', '$order', '$session_id')";
 			Database :: query($sql);
 
@@ -233,11 +233,11 @@ function addlinkcategory($type) {
  */
 function deletelinkcategory($type) {
 	global $catlinkstatus;
-	global $_course;	
+	global $_course;
 	$tbl_link              = Database :: get_course_table(TABLE_LINK);
 	$tbl_categories        = Database :: get_course_table(TABLE_LINK_CATEGORY);
 	$TABLE_ITEM_PROPERTY   = Database :: get_course_table(TABLE_ITEM_PROPERTY);
-    
+
     $course_id = api_get_course_int_id();
 
 	if ($type == 'link') {
@@ -301,19 +301,19 @@ function delete_link_from_search_engine($course_id, $link_id) {
 
 
 /**
- * 
+ *
  * Get link info
  * @param int link id
- * @return array link info  
- *    
+ * @return array link info
+ *
  * */
- 
+
 function get_link_info($id) {
      $tbl_link      = Database :: get_course_table(TABLE_LINK);
      $course_id     = api_get_course_int_id();
      $sql           = "SELECT * FROM " . $tbl_link . " WHERE c_id = $course_id AND id='" . intval($id) . "' ";
      $result        = Database::query($sql);
-     
+
      if (Database::num_rows($result)) {
         $data = Database::fetch_array($result);
      }
@@ -350,7 +350,7 @@ function editlinkcategory($type) {
 
 	$tbl_link       = Database :: get_course_table(TABLE_LINK);
 	$tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY);
-    
+
     $course_id = api_get_course_int_id();
 
 	if ($type == 'link') {
@@ -483,7 +483,7 @@ function editlinkcategory($type) {
 							'link_id' => (int) $link_id
 						),
 						SE_USER => (int) api_get_user_id(),
-						
+
 					);
 					$ic_slide->xapian_data = serialize($xapian_data);
 					$link_description = $all_specific_terms . ' ' . $link_description;
@@ -541,7 +541,7 @@ function editlinkcategory($type) {
 
 		// This is used to put the modified info of the category-form into the database.
 		if ($submit_category) {
-			$sql = "UPDATE " . $tbl_categories . " SET category_title='" . Database :: escape_string($_POST['category_title']) . "', description='" . Database :: escape_string($_POST['description']) . "' 
+			$sql = "UPDATE " . $tbl_categories . " SET category_title='" . Database :: escape_string($_POST['category_title']) . "', description='" . Database :: escape_string($_POST['description']) . "'
 			        WHERE c_id = $course_id AND id='" . Database :: escape_string($_POST['id']) . "'";
 			Database :: query($sql);
 			Display :: display_confirmation_message(get_lang('CategoryModded'));
@@ -568,7 +568,7 @@ function makedefaultviewcode($locatie) {
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  */
 function change_visibility($id, $scope) {
-	global $_course, $_user;    
+	global $_course, $_user;
 	if ($scope == 'link') {
 		api_item_property_update($_course, TOOL_LINK, $id, $_GET['action'], $_user['user_id']);
 		Display :: display_confirmation_message(get_lang('VisibilityChanged'));
@@ -589,17 +589,17 @@ function showlinksofcategory($catid) {
 	$session_id = api_get_session_id();
 	$condition_session = api_get_session_condition($session_id, true, true);
 	$catid = intval($catid);
-    
-    $course_id = api_get_course_int_id();    
 
-	$sqlLinks = "SELECT *, link.id FROM " . $tbl_link . " link, " . $TABLE_ITEM_PROPERTY . " itemproperties 
+    $course_id = api_get_course_int_id();
+
+	$sqlLinks = "SELECT *, link.id FROM " . $tbl_link . " link, " . $TABLE_ITEM_PROPERTY . " itemproperties
 				 WHERE  itemproperties.tool='" . TOOL_LINK . "' AND
-						link.id=itemproperties.ref AND 
-						link.category_id='" . $catid . "' AND 
-						(itemproperties.visibility='0' OR itemproperties.visibility='1') 
+						link.id=itemproperties.ref AND
+						link.category_id='" . $catid . "' AND
+						(itemproperties.visibility='0' OR itemproperties.visibility='1')
 						$condition_session AND
 						link.c_id = ".$course_id." AND
-						itemproperties.c_id = ".$course_id." 
+						itemproperties.c_id = ".$course_id."
 						ORDER BY link.display_order DESC";
 	$result = Database :: query($sqlLinks);
 	$numberoflinks = Database :: num_rows($result);
@@ -607,49 +607,49 @@ function showlinksofcategory($catid) {
     	echo '<table class="data_table" width="100%">';
     	$i = 1;
     	while ($myrow = Database :: fetch_array($result)) {
-    	        	    
-    
+
+
     		// Validacion when belongs to a session.
     		$session_img = api_get_session_image($myrow['session_id'], $_user['status']);
-    
+
     		$css_class = $i % 2 == 0 ? $css_class = 'row_odd' : $css_class = 'row_even';
-    		
+
     		$link_validator = '';
 			if (api_is_allowed_to_edit(null, true)) {
-			    $link_validator  = ''.Display::url(Display::return_icon('preview_view.png', get_lang('CheckURL'), array(), 16), '#', array('onclick'=>"check_url('".$myrow['id']."', '".addslashes($myrow['url'])."');"));    			
+			    $link_validator  = ''.Display::url(Display::return_icon('preview_view.png', get_lang('CheckURL'), array(), 16), '#', array('onclick'=>"check_url('".$myrow['id']."', '".addslashes($myrow['url'])."');"));
 			    $link_validator .= Display::span('', array('id'=>'url_id_'.$myrow['id']));
 			}
-    
+
     		if ($myrow['visibility'] == '1') {
     			echo '<tr class="'.$css_class.'">';
     			echo '<td align="center" valign="middle" width="15">';
-    			echo '<a href="link_goto.php?', api_get_cidreq(), '&amp;link_id=', $myrow['id'], '&amp;link_url=', urlencode($myrow['url']), '" target="_blank">
-    			         <img src="../../main/img/link.gif" border="0" alt="', get_lang('Link'), '"/></a></td>
-    			         <td width="80%" valign="top"><a href="link_goto.php?', api_get_cidreq(), '&amp;link_id=', $myrow['id'], '&amp;link_url=', urlencode($myrow['url']), '" target="', $myrow['target'], '">';
+    			echo '<a href="link_goto.php?'.api_get_cidreq().'&amp;link_id='.$myrow['id'].'&amp;link_url='.urlencode($myrow['url']).'" target="_blank">
+    			         <img src="../../main/img/link.gif" border="0" alt="'.get_lang('Link').'"/></a></td>
+    			         <td width="80%" valign="top"><a href="link_goto.php?'.api_get_cidreq().'&amp;link_id='.$myrow['id'].'&amp;link_url='.urlencode($myrow['url']).'" target="'.$myrow['target'].'">';
     			echo Security :: remove_XSS($myrow['url']);
-    			echo '</a>';    			
+    			echo '</a>';
     			echo $link_validator;
     			echo $session_img;
-    			echo '<br />', $myrow['title'];
+    			echo '<br />'.$myrow['title'];
     		} else {
     			if (api_is_allowed_to_edit(null, true)) {
     				echo '<tr class="'.$css_class.'">';
-    				echo '<td align="center" valign="middle" width="15"><a href="link_goto.php?', api_get_cidreq(), '&amp;link_id=', $myrow['id'], "&amp;link_url=", urlencode($myrow['url']), '" target="_blank" class="invisible">';
+    				echo '<td align="center" valign="middle" width="15"><a href="link_goto.php?'.api_get_cidreq().'&amp;link_id='.$myrow['id']."&amp;link_url=".urlencode($myrow['url']).'" target="_blank" class="invisible">';
     				echo Display :: return_icon('link_na.gif', get_lang('Link')), '</a>';
     				echo '</td><td width="80%" valign="top"><a href="link_goto.php?', api_get_cidreq(), '&amp;link_id=', $myrow['id'], '&amp;link_url=', urlencode($myrow['url']),'" target="', $myrow['target'], '"  class="invisible">';
     				echo Security :: remove_XSS($myrow['url']);
     				echo "</a>";
-    			    echo $link_validator;	
+    			    echo $link_validator;
     				echo $session_img, '<br />', $myrow['title'];
     			}
     		}
-    
+
     		echo '<td style="text-align:center;">';
     		if (api_is_allowed_to_edit(null, true)) {
-    			if ($session_id == $myrow['session_id']) {    
-    				echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;sec_token='.$token.'&amp;action=editlink&amp;category=' . (!empty ($category) ? $category : '') . '&amp;id=' . $myrow['id'] . '&amp;urlview=' . $urlview . '" title="' . get_lang('Modify') . '">' . 
+    			if ($session_id == $myrow['session_id']) {
+    				echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;sec_token='.$token.'&amp;action=editlink&amp;category=' . (!empty ($category) ? $category : '') . '&amp;id=' . $myrow['id'] . '&amp;urlview=' . $urlview . '" title="' . get_lang('Modify') . '">' .
     						Display :: return_icon('edit.png', get_lang('Modify'), array (), ICON_SIZE_SMALL) . '</a>';
-    				
+
     				// DISPLAY MOVE UP COMMAND only if it is not the top link.
     				/*
     				if ($i != 1) {
@@ -657,25 +657,25 @@ function showlinksofcategory($catid) {
     				} else {
     					echo Display :: return_icon('up_na.png', get_lang('Up'), array (), ICON_SIZE_SMALL) . '</a>';
     				}
-    
+
     				// DISPLAY MOVE DOWN COMMAND only if it is not the bottom link.
     				if ($i < $numberoflinks) {
     					echo '<a href="' . api_get_self() . '?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;urlview=' . $urlview . '&amp;down=' . $myrow[0] . '" title="' . get_lang('Down') . '">' . Display :: return_icon('down.png', get_lang('Down'), array (), ICON_SIZE_SMALL) . '', "</a>\n";
     				} else {
     					echo Display :: return_icon('down_na.png', get_lang('Down'), array (), ICON_SIZE_SMALL) . '', "</a>\n";
     				}*/
-    
+
     				if ($myrow['visibility'] == '1') {
-    					echo '<a href="link.php?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;action=invisible&amp;id=' . $myrow['id'] . '&amp;scope=link&amp;urlview=' . $urlview . '" title="' . get_lang('Hide') . '">' . 
+    					echo '<a href="link.php?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;action=invisible&amp;id=' . $myrow['id'] . '&amp;scope=link&amp;urlview=' . $urlview . '" title="' . get_lang('Hide') . '">' .
     					Display :: return_icon('visible.png', get_lang('Hide'), array (), ICON_SIZE_SMALL) . '</a>';
     				}
     				if ($myrow['visibility'] == '0') {
-    					echo ' <a href="link.php?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;action=visible&amp;id=' . $myrow['id'] . '&amp;scope=link&amp;urlview=' . $urlview . '" title="' . get_lang('Show') . '">' . 
+    					echo ' <a href="link.php?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;action=visible&amp;id=' . $myrow['id'] . '&amp;scope=link&amp;urlview=' . $urlview . '" title="' . get_lang('Show') . '">' .
     					Display :: return_icon('invisible.png', get_lang('Show'), array (), ICON_SIZE_SMALL) . '</a>';
     				}
-    				echo ' <a href="' . api_get_self() . '?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;action=deletelink&amp;id=', $myrow['id'], '&amp;urlview=', $urlview, "\" onclick=\"javascript: if(!confirm('" . get_lang('LinkDelconfirm') . "')) return false;\" title=\"" . get_lang('Delete') . '">' . 
+    				echo ' <a href="' . api_get_self() . '?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;action=deletelink&amp;id=', $myrow['id'], '&amp;urlview=', $urlview, "\" onclick=\"javascript: if(!confirm('" . get_lang('LinkDelconfirm') . "')) return false;\" title=\"" . get_lang('Delete') . '">' .
     				    Display :: return_icon('delete.png', get_lang('Delete'), array (), ICON_SIZE_SMALL) . '</a>';
-    
+
     			} else {
     				echo Display :: return_icon('edit_na.png', get_lang('EditionNotAvailableFromSession'), array (), ICON_SIZE_SMALL); //get_lang('EditionNotAvailableFromSession');
     			}
@@ -695,21 +695,21 @@ function showcategoryadmintools($categoryid) {
 
 	global $urlview, $aantalcategories, $catcounter, $token;
 	echo '<a href="' . api_get_self() . '?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;action=editcategory&amp;id=' . $categoryid . '&amp;urlview=' . $urlview . '" title=' . get_lang('Modify') . '">' . Display :: return_icon('edit.png', get_lang('Modify'), array (), ICON_SIZE_SMALL) . '</a>';
-	
+
 	// DISPLAY MOVE UP COMMAND only if it is not the top link.
 	if ($catcounter != 1) {
 		echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;sec_token='.$token.'&amp;catmove=true&amp;up=', $categoryid, '&amp;urlview=' . $urlview . '" title="' . get_lang('Up') . '">' . Display :: return_icon('up.png', get_lang('Up'), array (), ICON_SIZE_SMALL) . '</a>';
 	} else {
 		echo Display :: return_icon('up_na.png', get_lang('Up'), array (), ICON_SIZE_SMALL) . '</a>';
 	}
-	
+
 	// DISPLAY MOVE DOWN COMMAND only if it is not the bottom link.
 	if ($catcounter < $aantalcategories) {
 		echo '<a href="' . api_get_self() . '?' . api_get_cidreq() .'&amp;sec_token='.$token.'&amp;catmove=true&amp;down=' . $categoryid . '&amp;urlview=' . $urlview . '">
 					' . Display :: return_icon('down.png', get_lang('Down'), array (), ICON_SIZE_SMALL) . '</a>';
 	} else {
 		echo Display :: return_icon('down_na.png', get_lang('Down'), array (), ICON_SIZE_SMALL) . '</a>';
-	}	
+	}
 	echo '<a href="' . api_get_self() . '?' . api_get_cidreq() .  '&amp;sec_token='.$token.'&amp;action=deletecategory&amp;id=', $categoryid, "&amp;urlview=$urlview\" onclick=\"javascript: if(!confirm('" . get_lang('CategoryDelconfirm') . "')) return false;\">", Display :: return_icon('delete.png', get_lang('Delete'), array (), ICON_SIZE_SMALL) . '</a>';
 	$catcounter++;
 }
@@ -751,16 +751,16 @@ function movecatlink($catlinkid) {
 
 	// This code is copied and modified from announcements.php.
 	if (!empty($sortDirection)) {
-	    
+
 		if (!in_array(trim(strtoupper($sortDirection)), array ('ASC', 'DESC'))){
 		    $sortDirection = 'ASC';
 		}
-			
+
 		if ($catmove == 'true') {
 			$sqlcatlinks = "SELECT id, display_order FROM " . $movetable . " WHERE c_id = $course_id  ORDER BY display_order $sortDirection";
 		} else {
-			$sqlcatlinks = "SELECT id, display_order FROM " . $movetable . " 
-                			WHERE c_id = $course_id AND category_id='" . $catid[0] . "' 
+			$sqlcatlinks = "SELECT id, display_order FROM " . $movetable . "
+                			WHERE c_id = $course_id AND category_id='" . $catid[0] . "'
                 			ORDER BY display_order $sortDirection";
 		}
 		$linkresult = Database :: query($sqlcatlinks);
@@ -800,7 +800,7 @@ function get_cat($catname) {
 	// Get category id (existing or make new).
 	$tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY);
     $course_id = api_get_course_int_id();
-    
+
 	$result = Database :: query("SELECT id FROM " . $tbl_categories . " WHERE c_id = $course_id AND category_title='" . Database::escape_string($catname) . "'");
 	if (Database :: num_rows($result) >= 1 && ($row = Database :: fetch_array($result))) {
 		return $row['id']; // Several categories with same name: take the first.
@@ -808,7 +808,7 @@ function get_cat($catname) {
 
 	$result = Database :: query("SELECT MAX(display_order) FROM " . $tbl_categories);
 	list ($max_order) = Database :: fetch_row($result);
-	Database :: query("INSERT INTO " . $tbl_categories . " (c_id, category_title, description, display_order) 
+	Database :: query("INSERT INTO " . $tbl_categories . " (c_id, category_title, description, display_order)
 					   VALUES (".$course_id.", '" . Database::escape_string($catname) . "','','" . ($max_order +1) . "')");
 	return Database :: insert_id();
 }
@@ -819,9 +819,9 @@ function get_cat($catname) {
  */
 function put_link($url, $cat, $title, $description, $on_homepage, $hidden) {
 	$tbl_link = Database :: get_course_table(TABLE_LINK);
-    
+
     $course_id = api_get_course_int_id();
-    
+
 
 	$urleq = "url='" . Database :: escape_string($url) . "'";
 	$cateq = "category_id=" . intval($cat);
@@ -829,7 +829,7 @@ function put_link($url, $cat, $title, $description, $on_homepage, $hidden) {
 	$result = Database :: query("SELECT id FROM $tbl_link WHERE c_id = $course_id AND " . $urleq . ' AND ' . $cateq);
 
 	if (Database :: num_rows($result) >= 1 && ($row = Database :: fetch_array($result))) {
-		Database :: query("UPDATE $tbl_link set title='" . Database :: escape_string($title) . "', description='" . Database :: escape_string($description) . "' 
+		Database :: query("UPDATE $tbl_link set title='" . Database :: escape_string($title) . "', description='" . Database :: escape_string($description) . "'
 		WHERE c_id = $course_id AND  id='" . Database :: escape_string($row['id']) . "'");
 
 		$ipu = 'LinkUpdated';
@@ -839,7 +839,7 @@ function put_link($url, $cat, $title, $description, $on_homepage, $hidden) {
 		$result = Database :: query("SELECT MAX(display_order) FROM  $tbl_link WHERE c_id = $course_id AND category_id='" . intval($cat) . "'");
 		list ($max_order) = Database :: fetch_row($result);
 
-		Database :: query("INSERT INTO $tbl_link (c_id, url, title, description, category_id, display_order, on_homepage) 
+		Database :: query("INSERT INTO $tbl_link (c_id, url, title, description, category_id, display_order, on_homepage)
 						   VALUES (".api_get_course_int_id().", '" . Database :: escape_string($url) . "','" . Database :: escape_string($title) . "','" . Database :: escape_string($description) . "','" . intval($cat) . "','" . (intval($max_order) + 1) . "','" . intval($on_homepage) . "')");
 
 		$id = Database :: insert_id();
@@ -970,7 +970,7 @@ function import_csvfile() {
 /**
  * This function checks if the url is a youtube link
  * @author Jorge Frisancho
- * @author Julio Montoya - Fixing code 
+ * @author Julio Montoya - Fixing code
  * @version 1.0
  */
 function is_youtube_link($url) {
@@ -983,34 +983,34 @@ function get_youtube_video_id($url) {
 	$len = 11;
 
 	// The ID string starts after "v=", which is usually right after
-	// "youtube.com/watch?" in the URL    
-	$pos = strpos($url, "v=");    
-    
+	// "youtube.com/watch?" in the URL
+	$pos = strpos($url, "v=");
+
     $id = '';
-    
+
     //If false try other options
-    if ($pos === false) {         
+    if ($pos === false) {
         $url_parsed = parse_url($url);
-        
+
         //Youtube shortener
-        //http://youtu.be/ID   
+        //http://youtu.be/ID
         $pos = strpos($url, "youtu.be");
-        
+
         if ($pos == false) {
             $id = '';
-        } else {                        
+        } else {
             return substr($url_parsed['path'], 1);
-        }    
-           
+        }
+
         //if empty try the youtube.com/embed/ID
         if (empty($id)) {
             $pos = strpos($url, "embed");
             if ($pos === false) {
                 return '';
-            } else {                
+            } else {
                 return substr($url_parsed['path'], 7);
-            }	 
-        }    
+            }
+        }
     } else {
         // Offset the start location to match the beginning of the ID string
         $pos += 2;

文件差异内容过多而无法显示
+ 198 - 196
main/inc/lib/main_api.lib.php


+ 31 - 23
main/inc/lib/security.lib.php

@@ -50,7 +50,7 @@ class Security {
 
         $true_path = str_replace("\\", '/', realpath($abs_path));
         $found = strpos($true_path.'/', $checker_path);
-        
+
         if ($found === 0) {
             return true;
         } else {
@@ -260,7 +260,7 @@ class Security {
     	if ($filter_terms) {
     		$var = self::filter_terms($var);
     	}
-    	
+
         if ($user_status == COURSEMANAGERLOWSECURITY) {
             return $var;  // No filtering.
         }
@@ -282,8 +282,13 @@ class Security {
             $config->set('HTML.TidyLevel', 'light');
             $config->set('Core.ConvertDocumentToFragment', false);
             $config->set('Core.RemoveProcessingInstructions', true);
+
+            if (api_get_setting('enable_iframe_inclusion') == 'true') {
+                $config->set('Filter.Custom', array(new HTMLPurifier_Filter_AllowIframes()));
+            }
+
             //Shows _target attribute in anchors
-            $config->set('Attr.AllowedFrameTargets', array('_blank','_top','_self', '_parent')); 
+            $config->set('Attr.AllowedFrameTargets', array('_blank','_top','_self', '_parent'));
             if ($user_status == STUDENT) {
                 global $allowed_html_student;
                 $config->set('HTML.SafeEmbed', true);
@@ -308,52 +313,55 @@ class Security {
             $config->set('CSS.Proprietary', true);
             $purifier[$user_status] = new HTMLPurifier($config);
         }
+
+
+
         if (is_array($var)) {
             return $purifier[$user_status]->purifyArray($var);
         } else {
             return $purifier[$user_status]->purify($var);
         }
     }
-    
-    
+
+
     /**
-     * 
-     * Filter content 
+     *
+     * Filter content
      * @param	string content to be filter
      * @return 	string
      */
     function filter_terms($text) {
     	static $bad_terms = array();
-    	    	
-    	if (empty($bad_terms)) {    		
-    		$list = api_get_setting('filter_terms');    	    	
-    		$list = explode("\n", $list);    		
-    		$list = array_filter($list);    		
+
+    	if (empty($bad_terms)) {
+    		$list = api_get_setting('filter_terms');
+    		$list = explode("\n", $list);
+    		$list = array_filter($list);
     		if (!empty($list)) {
     			foreach($list as $term) {
     				$term = str_replace(array("\r\n", "\r", "\n", "\t"), '', $term);
-    				$html_entities_value = api_htmlentities($term, ENT_QUOTES, api_get_system_encoding()); 
+    				$html_entities_value = api_htmlentities($term, ENT_QUOTES, api_get_system_encoding());
     				$bad_terms[] = $term;
-    				if ($term != $html_entities_value) {    				 
+    				if ($term != $html_entities_value) {
     					$bad_terms[] = $html_entities_value;
     				}
     			}
     			$bad_terms = array_filter($bad_terms);
     		}
     	}
-    	    	
-    	$replace = '***';    	
+
+    	$replace = '***';
     	if (!empty($bad_terms)) {
     		//Fast way
     		$new_text = str_ireplace($bad_terms, $replace, $text, $count);
-    		
+
     		//We need statistics
     		/*
     		if (strlen($new_text) != strlen($text)) {
     			$table = Database::get_main_table(TABLE_STATISTIC_TRACK_FILTERED_TERMS);
     			$attributes = array();
-    			
-    			
+
+
     			$attributes['user_id'] 		=
     			$attributes['course_id'] 	=
     			$attributes['session_id'] 	=
@@ -364,11 +372,11 @@ class Security {
     		}
     		*/
     		$text = $new_text;
-    		
-    	}        	
+
+    	}
 		return $text;
     }
-    
+
 
     /**
      * This method provides specific protection (against XSS and other kinds of attacks) for static images (icons) used by the system.
@@ -411,5 +419,5 @@ class Security {
             return '';
         }
         return $image_path;
-    }   
+    }
 }

+ 11 - 8
main/install/db_main.sql

@@ -499,7 +499,7 @@ CREATE TABLE IF NOT EXISTS session_rel_course_rel_user (
   id_user int unsigned NOT NULL default '0',
   visibility int NOT NULL default 1,
   status int NOT NULL default 0,
-  legal_agreement INTEGER DEFAULT 0, 
+  legal_agreement INTEGER DEFAULT 0,
   PRIMARY KEY  (id_session,course_code,id_user),
   KEY id_user (id_user),
   KEY course_code (course_code)
@@ -867,7 +867,8 @@ VALUES
 ('enable_enable_webcam_clip',NULL,'radio','Tools','false','EnableWebCamClipTitle','EnableWebCamClipComment',NULL,NULL, 0),
 ('platform_unsubscribe_allowed', NULL, 'radio', 'Platform', 'false', 'PlatformUnsubscribeTitle', 'PlatformUnsubscribeComment', NULL, NULL, 1),
 ('activate_email_template', NULL, 'radio', 'Platform', 'false', 'ActivateEmailTemplateTitle', 'ActivateEmailTemplateComment', NULL, NULL, 0),
-('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.18142','DatabaseVersion','', NULL, NULL, 0);
+('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1),
+('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.18149','DatabaseVersion','', NULL, NULL, 0);
 
 
 /*
@@ -1167,7 +1168,7 @@ VALUES
 ('allow_users_to_change_email_with_no_password', 'true', 'Yes'),
 ('allow_users_to_change_email_with_no_password', 'false', 'No'),
 ('show_admin_toolbar', 'do_not_show', 'DoNotShow'),
-('show_admin_toolbar', 'show_to_admin', 'ShowToAdminsOnly'), 
+('show_admin_toolbar', 'show_to_admin', 'ShowToAdminsOnly'),
 ('show_admin_toolbar', 'show_to_admin_and_teachers', 'ShowToAdminsAndTeachers'),
 ('show_admin_toolbar', 'show_to_all', 'ShowToAllUsers'),
 ('use_custom_pages','true','Yes'),
@@ -1219,7 +1220,9 @@ VALUES
 ('platform_unsubscribe_allowed', 'true', 'Yes'),
 ('platform_unsubscribe_allowed', 'false', 'No'),
 ('activate_email_template', 'true', 'Yes'),
-('activate_email_template', 'false', 'No');
+('activate_email_template', 'false', 'No'),
+ ('enable_iframe_inclusion', 'true', 'Yes'),
+('enable_iframe_inclusion', 'false', 'No');
 
 UNLOCK TABLES;
 
@@ -2874,7 +2877,7 @@ CREATE TABLE IF NOT EXISTS skill_rel_user (
   user_id int NOT NULL,
   skill_id int NOT NULL,
   acquired_skill_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
-  assigned_by int NOT NULL, 
+  assigned_by int NOT NULL,
   PRIMARY KEY (id)
 );
 
@@ -2962,7 +2965,7 @@ CREATE TABLE IF NOT EXISTS track_course_ranking (
  id   int unsigned not null PRIMARY KEY AUTO_INCREMENT,
  c_id  int unsigned not null,
  session_id  int unsigned not null default 0,
- url_id  int unsigned not null default 0, 
+ url_id  int unsigned not null default 0,
  accesses int unsigned not null default 0,
  total_score int unsigned not null default 0,
  users int unsigned not null default 0,
@@ -2978,7 +2981,7 @@ DROP TABLE IF EXISTS user_rel_course_vote;
 CREATE TABLE IF NOT EXISTS user_rel_course_vote (
   id int unsigned not null AUTO_INCREMENT PRIMARY KEY,
   c_id int unsigned not null,
-  user_id int unsigned not null,  
+  user_id int unsigned not null,
   session_id int unsigned not null default 0,
   url_id int unsigned not null default 0,
   vote int unsigned not null default 0
@@ -2997,7 +3000,7 @@ CREATE TABLE IF NOT EXISTS chat (
 	message		TEXT NOT NULL,
 	sent		DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
 	recd		INTEGER UNSIGNED NOT NULL DEFAULT 0,
-	PRIMARY KEY (id)	
+	PRIMARY KEY (id)
 );
 
 ALTER TABLE chat ADD INDEX idx_chat_to_user (to_user);

+ 6 - 2
main/install/migrate-db-1.8.8-1.9.0-pre.sql

@@ -73,7 +73,7 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
 INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('languagePriority3', NULL, 'radio', 'Languages', 'user_selected_lang', 'LanguagePriority3Title', 'LanguagePriority3Comment', NULL, NULL, 0);
 INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('languagePriority4', NULL, 'radio', 'Languages', 'platform_lang', 'LanguagePriority4Title', 'LanguagePriority4Comment', NULL, NULL, 0);
 INSERT INTO settings_options (variable, value, display_text) VALUES ('languagePriority1','platform_lang','PlatformLanguage'), ('languagePriority1','user_profil_lang','UserLanguage'), ('languagePriority1','user_selected_lang','UserSelectedLanguage'), ('languagePriority1','course_lang','CourseLanguage'), ('languagePriority2','platform_lang','PlatformLanguage'), ('languagePriority2','user_profil_lang','UserLanguage'), ('languagePriority2','user_selected_lang','UserSelectedLanguage'), ('languagePriority2','course_lang','CourseLanguage'), ('languagePriority3','platform_lang','PlatformLanguage'), ('languagePriority3','user_profil_lang','UserLanguage'), ('languagePriority3','user_selected_lang','UserSelectedLanguage'), ('languagePriority3','course_lang','CourseLanguage'), ('languagePriority4','platform_lang','PlatformLanguage'), ('languagePriority4','user_profil_lang','UserLanguage'), ('languagePriority4','user_selected_lang','UserSelectedLanguage'), ('languagePriority4','course_lang','CourseLanguage');
--- Email is login 
+-- Email is login
 INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('login_is_email', NULL, 'radio', 'Platform', 'false', 'LoginIsEmailTitle', 'LoginIsEmailComment', NULL, NULL, 0);
 INSERT INTO settings_options (variable, value, display_text) VALUES ('login_is_email','true','Yes'),('login_is_email','false','No') ;
 INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('scorm_cumulative_session_time', NULL, 'radio', 'Course', 'true', 'ScormCumulativeSessionTimeTitle', 'ScormCumulativeSessionTimeComment', NULL, NULL, 0);
@@ -167,6 +167,10 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
 INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_public_certificates', 'true', 'Yes');
 INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_public_certificates', 'false', 'No');
 
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_iframe_inclusion', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_iframe_inclusion', 'false', 'No');
+
 INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_default_weight', NULL, 'textfield', 'Gradebook', '100', 'GradebookDefaultWeightTitle', 'GradebookDefaultWeightComment', NULL, NULL, 1);
 INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_default_grade_model_id', NULL, 'select', 'Gradebook', '', 'GradebookDefaultGradeModelTitle', 'GradebookDefaultGradeModelComment', NULL, NULL, 1);
 
@@ -251,7 +255,7 @@ INSERT INTO settings_options (variable, value, display_text) values ('platform_u
 
 
 -- Do not move this query
-UPDATE settings_current SET selected_value = '1.9.0.18142' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.9.0.18149' WHERE variable = 'chamilo_database_version';
 
 -- xxSTATSxx
 ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT NOT NULL DEFAULT '';

+ 43 - 40
main/link/link.php

@@ -41,12 +41,12 @@ $htmlHeadXtra[] = '<script type="text/javascript">
     		}
     	}
      });
-     
+
      function check_url(id, url) {
      	var url = "'.api_get_path(WEB_AJAX_PATH).'link.ajax.php?a=check_url&url=" +url;
      	var loading = " '.addslashes(Display::return_icon('loading1.gif')).'";
-     	$("#url_id_"+id).html(loading);  
-    	$("#url_id_"+id).load(url);    
+     	$("#url_id_"+id).html(loading);
+    	$("#url_id_"+id).load(url);
      }
  </script>';
 
@@ -122,21 +122,21 @@ function MM_popupMsg(msg) { //v1.0
 $nameTools = get_lang('Links');
 
 if (isset($_GET['action'])) {
-	$check_token = Security::check_token('request');    
+	$check_token = Security::check_token('request');
 	if ($check_token) {
 		switch ($_GET['action']) {
 			case 'addlink':
 				if ($link_submitted) {
 					if (!addlinkcategory("link")) {	// Here we add a link
 						unset($submit_link);
-					}				
+					}
 				}
 				break;
 			case 'addcategory':
 				if ($category_submitted) {
 					if (!addlinkcategory('category')) {	// Here we add a category
 						unset($submit_category);
-					}				
+					}
 				}
 				break;
 			case 'importcsv':
@@ -144,14 +144,14 @@ if (isset($_GET['action'])) {
 					import_csvfile();
 				}
 				break;
-			case 'deletelink':			
-				deletelinkcategory('link'); // Here we delete a link				
+			case 'deletelink':
+				deletelinkcategory('link'); // Here we delete a link
 				break;
 			case 'deletecategory':
-				deletelinkcategory('category'); // Here we delete a category				
+				deletelinkcategory('category'); // Here we delete a category
 				break;
 			case 'editlink':
-				editlinkcategory('link'); // Here we edit a link			
+				editlinkcategory('link'); // Here we edit a link
 				break;
 			case 'editcategory':
 				editlinkcategory('category'); // Here we edit a category
@@ -174,34 +174,35 @@ Display::display_introduction_section(TOOL_LINK);
 
 if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
 	echo '<div class="actions">';
-	if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){		
-		if (!empty($_POST['lp_id'])){			
+	if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){
+		if (!empty($_POST['lp_id'])){
 			$lp_id = Security::remove_XSS($_POST['lp_id']);
 		} else {
 			$lp_id = Security::remove_XSS($_GET['lp_id']);
-		}		
-		echo "<a href=\"../newscorm/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-3\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM)."</a>";		
+		}
+		echo "<a href=\"../newscorm/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-3\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM)."</a>";
 	} else {
 		//echo '<a href="link.php?cidReq='.Security::remove_XSS($_GET['cidReq']).'&amp;urlview='.Security::remove_XSS($_GET['urlview']).'">'.Display::return_icon('back.png', get_lang('BackToLinksOverview'),'',ICON_SIZE_MEDIUM).'</a>';
-	}	
+	}
 	echo '</div>';
-		
+
 	// 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']);
@@ -216,9 +217,11 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
                 }
                 $target_link = $link_info['target'];
             }
-            
 			echo '<input type="hidden" name="id" value="'.$clean_link_id.'" />';
-		}
+		} else {
+            $target_link = "_blank";
+        }
+        
 		echo '	<div class="control-group">
 					<label class="control-label">
 						<span class="form_required">*</span> URL
@@ -275,7 +278,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
 					</div>';
 		}
 		echo '	<div class="control-group">
-					<label class="control-label">						
+					<label class="control-label">
 					</label>
 					<div class="controls">
 						<input class="checkbox" type="checkbox" name="onhomepage" id="onhomepage" value="1"'.$onhomepage.'><label for="onhomepage"> '.get_lang('OnHomepage').'?</label>
@@ -290,7 +293,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
         $targets = array('_self'=>get_lang('LinkOpenSelf'),'_blank'=>get_lang('LinkOpenBlank'),'_parent'=>get_lang('LinkOpenParent'),'_top'=>get_lang('LinkOpenTop'));
 		foreach ($targets as $target_id => $target) {
 			$selected = '';
-			if ($target_id == $target_link) { 
+			if ($target_id == $target_link) {
 				$selected = ' selected="selected"';
 			}
 			echo '    	<option value="'.$target_id.'"'.$selected.'>'.$target.'</option> ';
@@ -301,17 +304,17 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
             </span>
 					</div>
 				</div>';
- 
+
 		if (api_get_setting('search_enabled') == 'true') {
 			require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
 			$specific_fields = get_specific_field_list();
-            
+
 			echo '	<div class="control-group">
 						<label class="control-label">
 							'.get_lang('SearchFeatureDoIndexLink').'
 						</label>
 						<div class="controls">
-                            <label for="index_document"> 
+                            <label for="index_document">
 							<input class="checkbox" type="checkbox" name="index_document" id="index_document" checked="checked">
                             '.get_lang('Yes').'
                             </label>
@@ -339,7 +342,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
 								<input name="%s" type="text" value="%s"/>
 							</div>
 						</div>';
-				
+
 				echo sprintf($sf_textbox, $specific_field['name'], $specific_field['code'], $default_values);
 			}
 		}
@@ -351,11 +354,11 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
 					<div class="controls">
 						<button class="btn save" type="submit" name="submitLink" value="OK">'.get_lang('SaveLink').'</button>
 					</div>
-				</div>';		
-		echo '</form>';		
-	} elseif(($_GET['action'] == 'addcategory' || $_GET['action'] == 'editcategory') && !$submit_category) {        
+				</div>';
+		echo '</form>';
+	} elseif(($_GET['action'] == 'addcategory' || $_GET['action'] == 'editcategory') && !$submit_category) {
 		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'] == 'addcategory') {
 			echo '<legend>'.get_lang('CategoryAdd').'</legend>';
 			$my_cat_title = get_lang('CategoryAdd');
@@ -363,7 +366,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
 			echo '<legend>'.get_lang('CategoryMod').'</legend>';
 			$my_cat_title = get_lang('CategoryMod');
 		}
-        
+
 		echo '<input type="hidden" name="sec_token" value="'.$token.'" />';
 		if ($_GET['action'] == 'editcategory') {
 			echo '<input type="hidden" name="id" value="'.$id.'" />';
@@ -411,9 +414,9 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
 	echo '<div class="actions">';
 	if (api_is_allowed_to_edit(null, true)) {
 		$urlview = Security::remove_XSS($urlview);
-		echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addlink&amp;category='.(!empty($category) ? $category : '').'&amp;urlview='.$urlview.'">'.Display::return_icon('new_link.png', get_lang('LinkAdd'),'',ICON_SIZE_MEDIUM).'</a>';		
+		echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addlink&amp;category='.(!empty($category) ? $category : '').'&amp;urlview='.$urlview.'">'.Display::return_icon('new_link.png', get_lang('LinkAdd'),'',ICON_SIZE_MEDIUM).'</a>';
 		echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addcategory&amp;urlview='.$urlview.'">'.Display::return_icon('new_folder.png', get_lang('CategoryAdd'),'',ICON_SIZE_MEDIUM).'</a>';
-			
+
 		   /* "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=importcsv&amp;urlview=".$urlview."\">".get_lang('CsvImport')."</a>\n", // RH*/
 	}
 	// Making the show none / show all links. Show none means urlview=0000 (number of zeros depending on the
@@ -422,7 +425,7 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
 	$resultcategories = Database::query($sqlcategories);
 	$aantalcategories = Database::num_rows($resultcategories);
 	if ($aantalcategories > 0) {
-	    $resultcategories = Database::query($sqlcategories);        
+	    $resultcategories = Database::query($sqlcategories);
 		echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&urlview=';
 		for ($j = 1; $j <= $aantalcategories; $j++) {
 			echo '0';
@@ -435,14 +438,14 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
 		echo '">'.Display::return_icon('view_tree.png', $showall,'',ICON_SIZE_MEDIUM).'</a>';
 	}
 	echo '</div>';
-	
+
 	// Displaying the links which have no category (thus category = 0 or NULL), if none present this will not be displayed
 	$sqlLinks = "SELECT * FROM ".$tbl_link." WHERE c_id = $course_id AND category_id=0 OR category_id IS NULL";
 	$result = Database::query($sqlLinks);
 	$numberofzerocategory = Database::num_rows($result);
-	
+
 	if ($numberofzerocategory !== 0) {
-	    echo '<table class="data_table">';	    
+	    echo '<table class="data_table">';
 		echo '<tr><th style="font-weight: bold; text-align:left;padding-left: 10px;">'.get_lang('General').'</th></tr>';
 		echo '</table>';
 		showlinksofcategory(0);

+ 51 - 53
main/template/default/layout/head.tpl

@@ -4,16 +4,14 @@
 <link href="http://www.chamilo.org" rel="copyright" />
 {{ favico }}
 <link rel="apple-touch-icon" href="{{ _p.web}}apple-touch-icon.png" />
-<link rel="apple-touch-icon" sizes="72x72" href="{{ _p.web}}apple-touch-icon-72x72-precomposed.png" />
-<link rel="apple-touch-icon" sizes="114x114" href="{{ _p.web}}apple-touch-icon-114x114-precomposed.png" />
 <meta name="apple-mobile-web-app-capable" content="yes" />
-<meta name="Generator" content="{{ _s.software_name }} {{ _s.system_version|slice(0,1) }}" /> 
+<meta name="Generator" content="{{ _s.software_name }} {{ _s.system_version|slice(0,1) }}" />
 {#  Use the latest engine in ie8/ie9 or use google chrome engine if available  #}
 {#  Improve usability in portal devices #}
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <!--[if ie]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
 <title>{{ title_string }}</title>
-<style type="text/css" media="screen"> 
+<style type="text/css" media="screen">
 /*<![CDATA[*/
 {{ css_style }}
 /*]]>*/
@@ -54,23 +52,23 @@ var disconnect_lang = '{{"ChatDisconnected"|get_lang}}';
 {{ css_file_to_string}}
 {{ extra_headers}}
 
-<script>    
+<script>
 function get_url_params(q, attribute) {
     var vars;
     var hash;
     if (q != undefined) {
         q = q.split('&');
         for(var i = 0; i < q.length; i++){
-            hash = q[i].split('=');            
+            hash = q[i].split('=');
             if (hash[0] == attribute) {
                 return hash[1];
-            }            
+            }
         }
-    }    
+    }
 }
 
 $(document).scroll(function() {
-    
+
     // Top bar scroll effect
     if ($('body').width() > 959) {
         if ($('.subnav').length) {
@@ -89,45 +87,45 @@ $(document).scroll(function() {
             }
         }
     }
-    
-    //Admin -> Settings toolbar 
-    
+
+    //Admin -> Settings toolbar
+
     if ($('.new_actions').length) {
         if (!$('.new_actions').attr('data-top')) {
             // If already fixed, then do nothing
             if ($('.new_actions').hasClass('new_actions-fixed')) return;
             // Remember top position
             var offset = $('.new_actions').offset();
-            
+
             var more_top = 0;
             if ($('.subnav').hasClass('new_actions-fixed')) {
                 more_top = 50;
             }
-            
-            $('.new_actions').attr('data-top', offset.top + more_top);            
+
+            $('.new_actions').attr('data-top', offset.top + more_top);
         }
-        
+
         if ($('.new_actions').attr('data-top') - $('.new_actions').outerHeight() <= $(this).scrollTop()) {
-            $('.new_actions').addClass('new_actions-fixed');              
+            $('.new_actions').addClass('new_actions-fixed');
         } else {
             $('.new_actions').removeClass('new_actions-fixed');
         }
     }
-    
-    //Bottom actions        
+
+    //Bottom actions
     if ($('.bottom_actions').length) {
-        
+
         if (!$('.bottom_actions').attr('data-top')) {
             // If already fixed, then do nothing
             if ($('.bottom_actions').hasClass('bottom_actions_fixed')) return;
-            
+
             // Remember top position
-            var offset = $('.bottom_actions').offset();            
-            $('.bottom_actions').attr('data-top', offset.top);          
+            var offset = $('.bottom_actions').offset();
+            $('.bottom_actions').attr('data-top', offset.top);
         }
-        
+
         if ($('.bottom_actions').attr('data-top') > $('body').outerHeight()) {
-            if ( ($('.bottom_actions').attr('data-top') - $('body').outerHeight() - $('.bottom_actions').outerHeight()) >= $(this).scrollTop()) {              
+            if ( ($('.bottom_actions').attr('data-top') - $('body').outerHeight() - $('.bottom_actions').outerHeight()) >= $(this).scrollTop()) {
                 $('.bottom_actions').addClass('bottom_actions_fixed');
                 $('.bottom_actions').css("width", "100%");
             } else {
@@ -135,7 +133,7 @@ $(document).scroll(function() {
                 $('.bottom_actions').removeClass('bottom_actions_fixed');
             }
         } else {
-            if ( ($('.bottom_actions').attr('data-top') -  $('.bottom_actions').outerHeight()) <= $(this).scrollTop()) {              
+            if ( ($('.bottom_actions').attr('data-top') -  $('.bottom_actions').outerHeight()) <= $(this).scrollTop()) {
                 $('.bottom_actions').addClass('bottom_actions_fixed');
                 $('.bottom_actions').css("width", "100%");
             } else {
@@ -143,7 +141,7 @@ $(document).scroll(function() {
                 $('.bottom_actions').css("width", "");
             }
         }
-    }    
+    }
 });
 
 function isScrolledIntoView(elem) {
@@ -158,7 +156,7 @@ function isScrolledIntoView(elem) {
 
 
 $(function() {
-    
+
     //Removes the yellow input in Chrome
     if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
         $(window).load(function(){
@@ -171,19 +169,19 @@ $(function() {
             });
         });
     }
-    
+
     //Fixes buttons to the new btn class
     if (!$('#button').hasClass('btn')) {
         $("button").addClass('btn');
-    }    
+    }
 
 
     //Dropdown effect
-    $('.dropdown-toggle').dropdown();   
-    
-    //Responsive effect 
+    $('.dropdown-toggle').dropdown();
+
+    //Responsive effect
     $(".collapse").collapse();
-    
+
     //Global popup
     $('.ajax').on('click', function() {
             var url     = this.href;
@@ -191,46 +189,46 @@ $(function() {
             if ($("#dialog").length == 0) {
                 dialog  = $('<div id="dialog" style="display:none"></div>').appendTo('body');
             }
-            
+
             width_value = 580;
             height_value = 450;
             resizable_value = true;
-            
-            new_param = get_url_params(url, 'width');            
+
+            new_param = get_url_params(url, 'width');
             if (new_param) {
-                width_value = new_param; 
+                width_value = new_param;
             }
-            
-            new_param = get_url_params(url, 'height')            
+
+            new_param = get_url_params(url, 'height')
             if (new_param) {
-                height_value = new_param; 
+                height_value = new_param;
             }
-            
+
             new_param = get_url_params(url, 'resizable');
             if (new_param) {
-                resizable_value = new_param; 
+                resizable_value = new_param;
             }
-         
+
             // load remote content
             dialog.load(
-                            url,                    
+                            url,
                             {},
                             function(responseText, textStatus, XMLHttpRequest) {
                                     dialog.dialog({
-                                            modal       : true, 
-                                            width       : width_value, 
+                                            modal       : true,
+                                            width       : width_value,
                                             height      : height_value,
                                             resizable   : resizable_value,
-                                    });	                    
+                                    });
             });
             //prevent the browser to follow the link
             return false;
     });
-    
+
     //old jquery.menu.js
     $('#navigation a').stop().animate({
         'marginLeft':'50px'
-    },1000);    
+    },1000);
     $('#navigation > li').hover(
         function () {
             $('a',$(this)).stop().animate({
@@ -245,12 +243,12 @@ $(function() {
     );
 
     /*
-    $(".td_actions").hide();    
-    
+    $(".td_actions").hide();
+
     $(".td_actions").parent('tr').mouseover(function() {
        $(".td_actions").show();
     });
-    
+
     $(".td_actions").parent('tr').mouseout(function() {
         $(".td_actions").hide();
     });*/

部分文件因为文件数量过多而无法显示