Browse Source

[svn r15040] Minor - Warning avoided (FS#2490)

Julio Montoya 17 năm trước cách đây
mục cha
commit
3f82db8ab7
2 tập tin đã thay đổi với 25 bổ sung20 xóa
  1. 12 11
      main/admin/configure_homepage.php
  2. 13 9
      main/newscorm/learnpath.class.php

+ 12 - 11
main/admin/configure_homepage.php

@@ -1,9 +1,9 @@
-<?php // $Id: configure_homepage.php 14625 2008-03-17 15:48:21Z elixir_inter $
+<?php // $Id: configure_homepage.php 15040 2008-04-23 20:28:52Z juliomontoya $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
 
-	Copyright (c) 2004-2007 Dokeos S.A.
+	Copyright (c) 2004-2008 Dokeos SPRL
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Olivier Brouckaert
@@ -18,7 +18,8 @@
 
 	See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
+	Mail: info@dokeos.com
 ==============================================================================
 */
 
@@ -743,8 +744,8 @@ switch($action){
 				
 					$TBL_LANGUAGES = Database::get_main_table(TABLE_MAIN_LANGUAGE);
 					$sql="SELECT isocode FROM ".$TBL_LANGUAGES." WHERE english_name='".$_SESSION["_user"]["language"]."'";
-					$result_sql=api_sql_query($sql);
-					$isocode_language=mysql_result($result_sql,0,0);
+					$result_sql=api_sql_query($sql,__FILE__,__LINE__);
+					$isocode_language=Database::result($result_sql,0,0);
 					$oFCKeditor->Config['DefaultLanguage'] = $isocode_language;
 					echo $oFCKeditor->CreateHtml();
 				}
@@ -782,7 +783,7 @@ switch($action){
 		else
 		{
 			$name = $newsf;
-			$open=file_get_contents($homep.$newsf.'_'.$lang.$ext);
+			$open=@file_get_contents($homep.$newsf.'_'.$lang.$ext);
 	
 		}
 		// print form header + important formSent attribute
@@ -832,8 +833,8 @@ switch($action){
 		
 			$TBL_LANGUAGES = Database::get_main_table(TABLE_MAIN_LANGUAGE);
 			$sql="SELECT isocode FROM ".$TBL_LANGUAGES." WHERE english_name='".$_SESSION["_user"]["language"]."'";
-			$result_sql=api_sql_query($sql);
-			$isocode_language=mysql_result($result_sql,0,0);
+			$result_sql=api_sql_query($sql,__FILE__,__LINE__);
+			$isocode_language=Database::result($result_sql,0,0);
 			$oFCKeditor->Config['DefaultLanguage'] = $isocode_language;
 			$upload_path = api_get_path(REL_PATH)."main/upload/";
 			
@@ -907,7 +908,7 @@ switch($action){
 				{
 					foreach($Categories as $enreg)
 					{
-						echo '<tr><td><img src="../img/opendir.gif" border="0" alt="'.get_lang('Directory').'"/>&nbsp;'.$enreg['name'].'</td></tr>';
+						echo '<tr><td><img src="../img/opendir.gif" border="0" />&nbsp;'.$enreg['name'].'</td></tr>';
 					}		
 					unset($Categories);
 				}
@@ -1002,11 +1003,11 @@ switch($action){
 			$home_notice = '';
 			if(file_exists($homep.$noticef.'_'.$lang.$ext))
 			{
-				$home_notice = file_get_contents($homep.$noticef.'_'.$lang.$ext);
+				$home_notice = @file_get_contents($homep.$noticef.'_'.$lang.$ext);
 			}
 			else
 			{
-				$home_notice = file_get_contents($homep.$noticef.$ext);
+				$home_notice = @file_get_contents($homep.$noticef.$ext);
 			}
 			echo $home_notice
 			?>

+ 13 - 9
main/newscorm/learnpath.class.php

@@ -4740,8 +4740,10 @@ class learnpath {
 											$return .= "\t\t\t\t\t" . '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . html_entity_decode(stripslashes($arrLP[$i]['title'])) . '</option>';
 									}
 								}
-								
-								reset($arrLP);
+								if (is_array($arrLP))
+								{
+									reset($arrLP);	
+								}
 								
 							$return .= "\t\t\t\t" . '</select>';
 						
@@ -4789,14 +4791,16 @@ class learnpath {
 						$return .= "\t\t" . '</tr>' . "\n";
 						
 						
-						$id_prerequisite=0;
-						foreach($arrLP as $key=>$value){
-							if($value['id']==$id){
-								$id_prerequisite=$value['prerequisite'];
-								break;
+						$id_prerequisite=0;
+						if (is_array($arrLP ))
+						{
+							foreach($arrLP as $key=>$value){
+								if($value['id']==$id){
+									$id_prerequisite=$value['prerequisite'];
+									break;
+								}
 							}
-						}
-						
+						}						
 						$arrHide=array();
 						for($i = 0; $i < count($arrLP); $i++)
 						{