Re: Fatal error: Cannot redeclare

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What is around this line?

/global/WEB_DAT/documents/fme/institute/get/lehre/course/lib.php:25


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Kai Kauer wrote:
> Am Dienstag, 5. August 2008 15:46:42 schrieb Daniel Brown:
>   
>> On Tue, Aug 5, 2008 at 9:37 AM, Kai Kauer <kai.kauer@xxxxxx> wrote:
>>     
>>> Hi @all,
>>>
>>> I was just installing the Moodle-Version 1.9.2 at our university. It was
>>> installed without any problems. But during testing and preparing for use
>>> I got this error message:
>>>
>>> Fatal error: Cannot redeclare make_log_url() (previously declared
>>> in /global/WEB_DAT/documents/fme/institute/get/lehre/course/lib.php:25)
>>> in ./lib.php on line 54
>>>       
>>     This is usually a result of the same function include script being
>> included twice, and thus, the function being defined a second time.
>> Check ./lib.php on line 54 and see if it's including itself, or if -
>> for whatever reason - there's two entries in that file starting with
>> "function make_log_url(***)".
>>
>>
>>
>>     *** Optional parameters may be enclosed within the parentheses.
>>
>>     
>
> This function make the error message
>
>   
>> function make_log_url($module, $url) {
>>     switch ($module) {
>>         case 'course':
>>         case 'file':
>>         case 'login':
>>         case 'lib':
>>         case 'admin':
>>         case 'calendar':
>>         case 'mnet course':
>>             return "/course/$url";
>>             break;
>>         case 'user':
>>         case 'blog':
>>             return "/$module/$url";
>>             break;
>>         case 'upload':
>>             return $url;
>>             break;
>>         case 'library':
>>         case '':
>>             return '/';
>>             break;
>>         case 'message':
>>             return "/message/$url";
>>             break;
>>         default:
>>             return "/mod/$module/$url";
>>             break;
>>     }
>> }
>>     
>
> and is in the whole project just called one time in this function:
>
>   
>> function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0,
>> $perpage=100, $url="", $modname="", $modid=0, $modaction="", $groupid=0) {
>>
>>     global $CFG;
>>
>>     if (!$logs = build_logs_array($course, $user, $date, $order,
>> $page*$perpage, $perpage, $modname, $modid, $modaction, $groupid)) {
>>         notify("No logs found!");
>>         print_footer($course);
>>         exit;
>>     }
>>
>>     $courses = array();
>>
>>     if ($course->id == SITEID) {
>>         $courses[0] = '';
>>         if ($ccc = get_courses('all', 'c.id ASC', 'c.id,c.shortname')) {
>>             foreach ($ccc as $cc) {
>>                 $courses[$cc->id] = $cc->shortname;
>>             }
>>         }
>>     } else {
>>         $courses[$course->id] = $course->shortname;
>>     }
>>
>>     $totalcount = $logs['totalcount'];
>>     $count=0;
>>     $ldcache = array();
>>     $tt = getdate(time());
>>     $today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
>>
>>     $strftimedatetime = get_string("strftimedatetime");
>>
>>     echo "<div class=\"info\">\n";
>>     print_string("displayingrecords", "", $totalcount);
>>     echo "</div>\n";
>>
>>     print_paging_bar($totalcount, $page, $perpage,
>> "$url&amp;perpage=$perpage&amp;");
>>
>>     echo '<table class="logtable genearlbox boxaligncenter"
>> summary="">'."\n"; // echo "<table class=\"logtable\" cellpadding=\"3\"
>> cellspacing=\"0\" summary=\"\">\n"; echo "<tr>";
>>     if ($course->id == SITEID) {
>>         echo "<th class=\"c0 header\"
>> scope=\"col\">".get_string('course')."</th>\n"; }
>>     echo "<th class=\"c1 header\"
>> scope=\"col\">".get_string('time')."</th>\n"; echo "<th class=\"c2 header\"
>> scope=\"col\">".get_string('ip_address')."</th>\n"; echo "<th class=\"c3
>> header\" scope=\"col\">".get_string('fullname')."</th>\n"; echo "<th
>> class=\"c4 header\" scope=\"col\">".get_string('action')."</th>\n"; echo
>> "<th class=\"c5 header\" scope=\"col\">".get_string('info')."</th>\n"; echo
>> "</tr>\n";
>>
>>     // Make sure that the logs array is an array, even it is empty, to
>> avoid warnings from the foreach. if (empty($logs['logs'])) {
>>         $logs['logs'] = array();
>>     }
>>
>>     $row = 1;
>>     foreach ($logs['logs'] as $log) {
>>
>>         $row = ($row + 1) % 2;
>>
>>         if (isset($ldcache[$log->module][$log->action])) {
>>             $ld = $ldcache[$log->module][$log->action];
>>         } else {
>>             $ld = get_record('log_display', 'module', $log->module,
>> 'action', $log->action); $ldcache[$log->module][$log->action] = $ld;
>>         }
>>         if ($ld && is_numeric($log->info)) {
>>             // ugly hack to make sure fullname is shown correctly
>>             if (($ld->mtable == 'user') and ($ld->field ==
>> sql_concat('firstname', "' '" , 'lastname'))) { $log->info =
>> fullname(get_record($ld->mtable, 'id', $log->info), true); } else {
>>                 $log->info = get_field($ld->mtable, $ld->field, 'id',
>> $log->info); }
>>         }
>>
>>         //Filter log->info
>>         $log->info = format_string($log->info);
>>
>>         // If $log->url has been trimmed short by the db size restriction
>>         // code in add_to_log, keep a note so we don't add a link to a
>> broken url $tl=textlib_get_instance();
>>         $brokenurl=($tl->strlen($log->url)==100 &&
>> $tl->substr($log->url,97)=='...');
>>
>>         $log->url  = strip_tags(urldecode($log->url));   // Some XSS
>> protection $log->info = strip_tags(urldecode($log->info));  // Some XSS
>> protection $log->url  = s($log->url); /// XSS protection and XHTML
>> compatibility - should be in link_to_popup_window() instead!!
>>
>>         echo '<tr class="r'.$row.'">';
>>         if ($course->id == SITEID) {
>>             echo "<td class=\"cell c0\">\n";
>>             if (empty($log->course)) {
>>                 echo get_string('site') . "\n";
>>             } else {
>>                 echo "    <a
>> href=\"{$CFG->wwwroot}/course/view.php?id={$log->course}\">".
>> format_string($courses[$log->course])."</a>\n"; }
>>             echo "</td>\n";
>>         }
>>         echo "<td class=\"cell c1\" align=\"right\">".userdate($log->time,
>> '%a'). ' '.userdate($log->time, $strftimedatetime)."</td>\n"; echo "<td
>> class=\"cell c2\">\n";
>>        
>> link_to_popup_window("/iplookup/index.php?ip=$log->ip&amp;user=$log->userid
>> ", 'iplookup',$log->ip, 440, 700); echo "</td>\n";
>>         $fullname = fullname($log,
>> has_capability('moodle/site:viewfullnames',
>> get_context_instance(CONTEXT_COURSE, $course->id))); echo "<td class=\"cell
>> c3\">\n";
>>         echo "    <a
>> href=\"$CFG->wwwroot/user/view.php?id={$log->userid}&amp;course={$log->cour
>> se}\">$fullname</a>\n"; echo "</td>\n";
>>         echo "<td class=\"cell c4\">\n";
>>         $displayaction="$log->module $log->action";
>>         if($brokenurl) {
>>             echo $displayaction;
>>         } else {
>>             link_to_popup_window( make_log_url($log->module,$log->url),
>> 'fromloglive',$displayaction, 440, 700); }
>>         echo "</td>\n";;
>>         echo "<td class=\"cell c5\">{$log->info}</td>\n";
>>         echo "</tr>\n";
>>     }
>>     echo "</table>\n";
>>
>>     print_paging_bar($totalcount, $page, $perpage,
>> "$url&amp;perpage=$perpage&amp;"); }
>>     
>
>
> I can't find the mistake.
>
>
>   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux