ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/wiki/diff/difflib.php000064400000057440152267124620023444 0ustar00serial=$j; $V[$j]->hash=crc32($file2[$j]); } // Step 2 Sort by hash,serial ///////// usort($V,"ouwiki_diff_sort_v"); // Make it start from 1 again array_unshift($V,'bogus'); unset($V[0]); // $V is now an array including the line number 'serial' and hash // of each line in file 2, sorted by hash and then serial. // Step 3 Equivalence classes ///////// $E=array(); $E[0]=new StdClass; $E[0]->serial=0; $E[0]->last=true; for($j=1;$j<=$n;$j++) { $E[$j]=new StdClass; $E[$j]->serial=$V[$j]->serial; $E[$j]->last=$j===$n || $V[$j]->hash!==$V[$j+1]->hash; } // E is now an array sorted the same way as $V which includes // the line number 'serial' and whether or not that is the 'last' // line in the given equivalence class, i.e. set of identical lines // Step 4 For each line in file1, finds start of equivalence class ///////// $P=array(); for($i=1;$i<=$m;$i++) { // Find matching last entry from equivalence list $P[$i]=ouwiki_diff_find_last($V,$E,crc32($file1[$i])); } // P is now an array that finds the index (within $V) of the *first* // matching line in $V (referencing file 2, but not a line number, // because sorted in $V order) for each line in file 1. In other words // if you were to start at the P-value in $V and continue through, you // would find all the lines from file 2 that are equal to the given line // from file 1. // Step 5 Initialise vector of candidates ///////// // I do not trust PHP references further than I can throw them (preferably // at the idiot who came up with the idea) so I am using a separate array // to store candidates and all references are integers into that. $candidates=array(); $candidates[0]=new StdClass; $candidates[0]->a=0; $candidates[0]->b=0; $candidates[0]->previous=null; $candidates[1]=new StdClass; $candidates[1]->a=$m+1; $candidates[1]->b=$n+1; $candidates[1]->previous=null; $K=array(); $K[0]=0; // Ref to candidate 0 $K[1]=1; // Ref to candidate 1 $k=0; // Step 6 Merge stage ///////// for($i=1;$i<=$m;$i++) { if($P[$i]!==0) { ouwiki_diff_merge($K,$k,$i,$E,$P[$i],$candidates); } } // Step 7 ///////// $J=array(); for($i=1;$i<=$m;$i++) { $J[$i]=0; } // Step 8 Follow candidate chain to make nice representation ///////// $index=$K[$k]; while(!is_null($index)) { // Stop when we reach the first, dummy candidate if($candidates[$index]->a!=0) { $J[$candidates[$index]->a]=$candidates[$index]->b; } $index=$candidates[$index]->previous; } // Step 9 Get rid of 'jackpots' (hash collisions) ///////// for($i=1;$i<=$m;$i++) { if($J[$i]!=0 && $file1[$i]!=$file2[$J[$i]]) { $J[$i]=0; } } // Done! (Maybe.) return $J; } // Functions needed by parts of the algorithm ///////////////////////////////////////////// // Merge, from step 7 (Appendix A.3) function ouwiki_diff_merge(&$K,&$k,$i,&$E,$p,&$candidates) { $r=0; $c=$K[0]; while(true) { $j=$E[$p]->serial; // Paper says 'i' but this is wrong (OCR) // Binary search in $K from $r to $k $min=$r; $max=$k+1; while(true) { $try = (int)(($min+$max)/2); if($candidates[$K[$try]]->b >= $j) { $max=$try; } else if($candidates[$K[$try+1]]->b <= $j) { $min=$try+1; } else { // $try is less and $try+1 is more $s=$try; break; } if($max<=$min) { $s=-1; break; } } if($s>-1) { if($candidates[$K[$s+1]]->b > $j) { // Create new candidate $index=count($candidates); $candidates[$index]=new StdClass; $candidates[$index]->a=$i; $candidates[$index]->b=$j; $candidates[$index]->previous=$K[$s]; $K[$r]=$c; $r=$s+1; $c=$index; // Or should this go before? } if($s===$k) { $K[$k+2]=$K[$k+1]; $k++; break; } } if($E[$p]->last) { break; } $p++; } $K[$r]=$c; } // From Step 2 function ouwiki_diff_sort_v($a,$b) { if($a->hash < $b->hash) { return -1; } else if($a->hash > $b->hash) { return 1; } else if($a->serial < $b->serial) { return -1; } else if($a->serial > $b->serial) { return 1; } else { return 0; } } // From Step 4 function ouwiki_diff_find_last(&$V,&$E,$hash) { // Binary search in $V until we find something with $hash // Min = 1, array is 1-indexed $min=1; // Max = 1 higher than highest key end($V); $max=key($V)+1; while(true) { $try = (int)(($min+$max)/2); if($V[$try]->hash > $hash) { $max=$try; } else if($V[$try]->hash < $hash) { $min=$try+1; } else { // Equal break; } if($max<=$min) { // No matching line return 0; } } // Now check back in $E to find the first line of that equivalence class for($j=$try;!$E[$j-1]->last;$j--) ; return $j; } /////////////////////////// /** * Class representing one 'line' of HTML content for the purpose of * text comparison. */ class ouwiki_line { /** Array of ouwiki_words */ var $words=array(); /** * Construct line object based on a chunk of text. * @param string $data Text data that makes up this 'line'. (May include line breaks etc.) * @param int $linepos Position number for first character in text */ public function __construct($data,$linepos) { // 1. Turn things we don't want into spaces (so that positioning stays same) // Whitespace replaced with space $data=preg_replace('/\s/',' ',$data); // Various ways of writing non-breaking space replaced with space // Note that using a single param for replace only works because all // the search strings are 6 characters long $data=str_replace(array(' ',' ',' '),' ',$data); // Tags replaced with equal number of spaces $data = preg_replace_callback('/<.*?'.'>/', function($matches) { return preg_replace("/./", " ", $matches[0]); }, $data); // 2. Analyse string so that each space-separated thing // is counted as a 'word' (note these may not be real words, // for instance words may include punctuation at either end) $pos=0; while(true) { // Find a non-space $strlendata = strlen($data); for(;$pos < $strlendata && substr($data,$pos,1)===' ';$pos++) ; if($pos==$strlendata) { // No more content break; } // Aaaand find the next space after that $space2=strpos($data,' ',$pos); if($space2===false) { // No more spaces? Everything left must be a word $this->words[]=new ouwiki_word(substr($data,$pos),$pos+$linepos); break; } else { $this->words[]=new ouwiki_word(substr($data,$pos,$space2-$pos),$pos+$linepos); $pos=$space2; } } } /** * Old syntax of class constructor. Deprecated in PHP7. * * @deprecated since Moodle 3.1 */ public function ouwiki_line($data, $linepos) { debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); self::__construct($data, $linepos); } /** * @return string Normalised string representation of this line object */ function get_as_string() { $result=''; foreach($this->words as $word) { if($result!=='') { $result.=' '; } $result.=$word->word; } return $result; } /** * Static function converts lines to strings. * @param array $lines Array of ouwiki_line * @return array Array of strings */ static function get_as_strings($lines) { $strings=array(); foreach($lines as $key=>$value) { $strings[$key]=$value->get_as_string(); } return $strings; } /** * @return True if there are no words in the line */ function is_empty() { return count($this->words)===0; } } /** * Represents single word for html comparison. Note that words * are just chunks of plain text and may not be actual words; * they could include punctuation or (if there was e.g. a span * in the middle of something) even be part-words. */ class ouwiki_word { /** Word as plain string */ var $word; /** Start position in original xhtml */ var $start; public function __construct($word,$start) { $this->word=$word; $this->start=$start; } /** * Old syntax of class constructor. Deprecated in PHP7. * * @deprecated since Moodle 3.1 */ public function ouwiki_word($word, $start) { debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); self::__construct($word, $start); } } /** * Prepares XHTML content for text difference comparison. * @param string $content XHTML content [NO SLASHES] * @return array Array of ouwiki_line objects */ function ouwiki_diff_html_to_lines($content) { // These functions are a pain mostly because PHP preg_* don't provide // proper information as to the start/end position of matches. As a // consequence there is a lot of hackery going down. At every point we // replace things with spaces rather than getting rid, in order to store // positions within original content. // Get rid of all script, style, object tags (that might contain non-text // outside tags) $content=preg_replace_callback( '^(