OJT e 055717A 2007/09/20 e e e 20 160 1. moodle 2. moodle 3. moodle 4. moodle question webct 5. moodle 6. moodle 1
1 moodle 3 2 3 2.1................................ 3 2.1.1......................... 4 2.1.2 zip........................... 4 2.2.................................... 5 2.2.1............................... 5 2.3.......................................... 5 2.3.1 CSV.............................. 6 2.3.2.............................. 6 2.4 moodle question webct 6 2.5................................. 6 2.5.1...................................... 7 2.6.......................... 7 2.6.1 zip............................. 7 2.7..................................... 8 3 8 3.1............................................ 8 3.2....................................... 8 3.3............................................ 9 3.4............................................ 9 3.5............................................. 10 4 11 2
1 moodle http://download.moodle.org/ GNU GENERAL PUBLIC LI- CENSE Version 2 1 e PHP,MySQL javascript OS moodle,, dataroot/blocks//block_.php # dataroot/blocks//config_instance.html # dataroot/blocks//db/ # dataroot/lang//block_.php # cron dataroot/mod/ /db/mysql.php dataroot/mod/ /db/mysql.sql dataroot/mod/ /icon.gif # 16x16 dataroot/mod/ /index.php # dataroot/mod/ /lib.php # dataroot/mod/ /mod.html # dataroot/mod/ /version.php # dataroot/mod/ /view.php # dataroot/lang//.php # dataroot/mod/ /config.html # dataroot/filter//defaultsettings.php # dataroot/filter//filter.php # dataroot/filter//filterconfig.html # dataroot/lang//.php # 2 2.1 moodle assignment block zip 1 GPL 3
2.1.1 scandir copy 1. UNIX scandir... 2. copy... 2.1.2 zip zip GNU GENERAL PUBLIC LICENSE phpmyadmin zip.lib.php echo printf /**zip and download $targetfiles *(array)$targetfiles files path which we hope download * * *(int)$targetfilesnum targetfiles num *(int)$countdown counter *(string)$zipname zip file name *(object)$zipfile object for zip and download files *(string)$filename file name *(string)$zip_buffer zip file s buffer * header() HTTP moodle **/ function zip_and_down($targetfiles,$zipname){ $targetfilesnum = count($targetfiles); $countdown = $targetfilesnum-1; //echo <center>target files</center><hr><pre> ;var_dump($targetfiles);echo </pre><hr> ; //printf("countdown = %d <br>filename = %s <br>",$targetfilesnum,$zipname); header( "Content-Type: application/octet-stream" ); header( "Content-disposition: attachment; filename=$zipname" ); require_once( zip.lib.php ); $zipfile = new zipfile(); while($countdown >= 0){ $handle = fopen($targetfiles[$countdown], "rb"); $contents = fread($handle, filesize($targetfiles[$countdown])); fclose($handle); $filename = basename($targetfiles[$countdown]); $zipfile $->$ addfile($contents, $filename ); $countdown--; $zip_buffer = $zipfile$->$file(); print $zip_buffer;//(download) 4
zip print zip zip fopen > fread > print Content-Type: MIME 2.2 moodle HTML 2.2.1 string mbstring mb list encodings mb detect order mb detect encoding UTF-8, UTF-7, ASCII, EUC-JP,SJIS, eucjp-win, SJIS-win, JIS, ISO-2022-JP mb list encodings ISO-8859-1 UTF-8 UTF-8 ISO-8859-1 UTF-8 ASCII UTF-7 UTF-8 ASCII mb convert encodings string moodle CR x0d moodle CR 2 CR+LF windows ASCII 2.3 CSV enrole student unenrole student MySQL CSV 2 http://moodle.org/mod/forum/discuss.php?d=38860 5
2.3.1 CSV CSV, CSV 2.3.2 moodle get records sql select from where MySQL SELECT F ROM W HERE space $query=$select.$space.$from.$space.$where; $users = get_records_sql("$query"); moodle SQL moodle moodle 2.4 moodle question webct moodle question webct question/format/webct/format.php 189 $line = iconv("windows-1252","utf-8",$line); iconv Windows-1252 mb convert encoding $line = mb_convert_encoding($line, UTF-8, auto ); auto 2.5 HTML img 6
2.5.1 imagesize_filter((string),(int),(int) ) width="500" height="250" 1 100 100 setpercenttage function imagesize_filter($imagefile=,$maxwidthsize=0,$maxhightsize=0) { $imgstring = ; if($imageinfo = getimagesize($imagefile)){ $setpercenttage = array(100,95,90,85,80,75,70,75,70,65,60,55,50,45,40,35,30,25,20,15,10,5,4,3,2,1); $maxcount = count($setpercenttage); $count = 0; while($imageinfo[0]*$setpercenttage[$count]*0.01 > $maxwidthsize){ if ($count+1 >= $maxcount){ break; $count++; while($imageinfo[1]*$setpercenttage[$count]*0.01 > $maxhightsize){ if ($count+1 >= $maxcount){ break; $count++; $imgstring.= width=".$imageinfo[0]*$setpercenttage[$count]*0.01. " height=".$imageinfo[1]*$setpercenttage[$count]*0.01. " ; return $imgstring; 2.6 2.6.1 zip zip 0Kbyte zip zip zip files() zip moolde header() moolde readfile() PHP if (!zip_files(,zip )) { error(get_string("zipfileserror","error")); else{ echo success!! ; 7
//print header header( "Content-Type: application/octet-stream" ); header( "Content-disposition: attachment; filename= " ); if(!readfile(zip )){ printf( can not read %s,$zipfilename); 2.7 moodle 3 README.txt README.txt mysql.sql option mysql.sql sample CREATE TABLE prefix_sample ( id int(10) NOT NULL auto_increment, course int(10) NOT NULL default 0, timemodified int(10) NOT NULL default 0, name varchar(255) NOT NULL default, PRIMARY KEY (id), KEY course (course) ) TYPE=MyISAM COMMENT= sample Module ; moodle 3 3.1 moodle moodle 3.2 3 http://download.moodle.org/plugins16/mod/newmodule.zip 8
3.3 3.4 CGI CGI CGI 4 4 http://www.asahi-net.or.jp/ wv7y-kmr/memo/php security.html 9
moodle capability moodle SQL $cmd = optinal_param( cmd,, RAW ); exec($cmd); rm $str = optinal_param( cmd,, RAW ); echo $str; HTML JavaScript moodle $count = optinal_param( cmd,, INT ); while($count > 0){ printf("roop %d",$count); $count--; URL URL 3.5 moodle 10
4 [1] moodle http://moodle.org/course/view.php?id=14 [2] moodle download http://download.moodle.org/ [3] PHP 2006/11/6 [4] PHP http://www.php.net/manual/ja/ [5] PHP Web http://www.asahi-net.or.jp/~wv7y-kmr/memo/php_security.html 11
e 12