From 5d14d5ec7396fcffaeaa429de697924eac266f69 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 19 Oct 2010 13:13:14 +0200 Subject: [PATCH 1/4] Fixing delete condition in works see BT#1673 --- main/work/work.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/work/work.php b/main/work/work.php index 7fb674e095..e01a42b150 100755 --- a/main/work/work.php +++ b/main/work/work.php @@ -784,7 +784,7 @@ else { $author_qry = Database::query($author_sql); - if (Database :: num_rows($author_qry) == 1 AND api_get_course_setting('student_delete_own_publication') == 1 || api_is_allowed_to_edit(null,true)) { + if ((Database :: num_rows($author_qry) == 1 AND api_get_course_setting('student_delete_own_publication') == 1) || api_is_allowed_to_edit(null,true)) { //we found the current user is the author $queryString1 = "SELECT url FROM " . $work_table . " WHERE id = '$delete'"; $result1 = Database::query($queryString1); From cf4dbd80a7f30fec3ca214c2c678e4858aed2db3 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 19 Oct 2010 18:22:49 +0200 Subject: [PATCH 2/4] Minor Cleaning file --- main/exercice/exercise.lib.php | 74 +++------------------------------- 1 file changed, 6 insertions(+), 68 deletions(-) diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php index 958ccde47c..fc58f52043 100755 --- a/main/exercice/exercise.lib.php +++ b/main/exercice/exercise.lib.php @@ -145,71 +145,8 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre // because [] is parsed here we follow this procedure: $answer = text_filter($answer); - /* // Deprecated code - // 1. find everything between the [tex] and [/tex] tags - $startlocations = api_strpos($answer,'[tex]'); - $endlocations = api_strpos($answer,'[/tex]'); - - if ($startlocations !== false && $endlocations !== false) { - $texstring = api_substr($answer,$startlocations,$endlocations-$startlocations+6); - // 2. replace this by {texcode} - $answer = str_replace($texstring,'{texcode}',$answer); - } - */ - - // 3. do the normal matching parsing - // replaces [blank] by an input field - //getting the matches $answer = api_ereg_replace('\[[^]]+\]','',($answer)); - - // Change input size - /* - preg_match_all('/\[[^]]+]/',$answer,$matches); - $answer=ereg_replace('\[[^]]+\]','',($answer)); - - // 4. resize the input - - - foreach($matches[0] as $match) { - $answer_len = strlen($match)-2; - //we will only replace 1 item - // echo implode("replace term", explode("search term", "input", $limit)); - if ($answer_len <= 5) { - $answer = (implode("5", explode("@@", $answer, 2))); - } elseif($answer_len <= 10) { - $answer = (implode("10", explode("@@", $answer, 2))); - } elseif($answer_len <= 20) { - $answer = (implode("20", explode("@@", $answer, 2))); - } elseif($answer_len <= 30) { - $answer = (implode("30", explode("@@", $answer, 2))); - } elseif($answer_len <= 40) { - $answer = (implode("45", explode("@@", $answer, 2))); - } elseif($answer_len <= 50) { - $answer = (implode("60", explode("@@", $answer, 2))); - } elseif($answer_len <= 60) { - $answer = (implode("70", explode("@@", $answer, 2))); - } elseif($answer_len <= 70) { - $answer = (implode("80", explode("@@", $answer, 2))); - } elseif($answer_len <= 80) { - $answer = (implode("90", explode("@@", $answer, 2))); - } elseif($answer_len <= 90) { - $answer = (implode("100", explode("@@", $answer, 2))); - } elseif($answer_len <= 100) { - $answer = (implode("110", explode("@@", $answer, 2))); - } elseif($answer_len > 100 ) { - $answer = (implode("120", explode("@@", $answer, 2))); - } - } - - */ - - /* // Deprecated code - // 5. replace the {texcode by the api_pare_tex parsed code} - $texstring = api_parse_tex($texstring); - $answer=str_replace("{texcode}",$texstring,$answer); - */ - } // Unique answer @@ -356,12 +293,12 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre } elseif ($answerType == HOT_SPOT) { // Question is of type HOT_SPOT - $questionName=$objQuestionTmp->selectTitle(); - $questionDescription=$objQuestionTmp->selectDescription(); + $questionName = $objQuestionTmp->selectTitle(); + $questionDescription = $objQuestionTmp->selectDescription(); // Get the answers, make a list - $objAnswerTmp=new Answer($questionId); - $nbrAnswers=$objAnswerTmp->selectNbrAnswers(); + $objAnswerTmp = new Answer($questionId); + $nbrAnswers = $objAnswerTmp->selectNbrAnswers(); // get answers of hotpost $answers_hotspot = array(); @@ -396,6 +333,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1'); //$tes = isset($_GET['modifyAnswers']) ? '0' : '1'; //echo $tes; + $s .= '